/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface-2: #22222e;
  --surface-3: #2a2a38;
  --border: #2e2e3e;
  --text: #f0f0f5;
  --text-muted: #8888a0;
  --text-dim: #5c5c72;
  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-dim: rgba(34,197,94,0.12);
  --accent: #6366f1;
  --accent-dim: rgba(99,102,241,0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 120px;
}

/* === Header === */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.shop-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 20px;
}

/* === Tab Navigation === */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* === Step Indicator === */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 8px;
  gap: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

.step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  font-weight: 700;
  font-size: 0.75rem;
}

.step.active {
  color: var(--primary);
}

.step.active span {
  background: var(--primary);
  color: var(--bg);
}

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

.step.done span {
  background: var(--primary-dim);
  color: var(--primary);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--surface-3);
  margin: 0 8px;
  max-width: 40px;
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* === Step Panels === */
.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

/* === Tip Entry === */
.tip-entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.tip-input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
}

.input-wrapper.dollar::before {
  content: '$';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.1rem;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 30px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.input-wrapper input:focus {
  border-color: var(--primary);
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

/* === Total Banner === */
.total-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-dim);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.total-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.total-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* === Split Method === */
.split-method {
  margin-bottom: 20px;
}

.split-method label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.method-pills {
  display: flex;
  gap: 8px;
}

.pill {
  flex: 1;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* === Buttons === */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 12px 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-secondary.full-width {
  width: 100%;
  text-align: center;
  margin-top: 16px;
}

.btn-small {
  padding: 8px 16px;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--primary);
  color: #000;
}

.step-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.step-actions .btn-primary {
  flex: 2;
}

.step-actions .btn-secondary {
  flex: 1;
}

/* === Team Select === */
.team-select-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.team-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.team-select-item:hover {
  border-color: var(--text-dim);
}

.team-select-item.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.team-select-item .checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 0.75rem;
}

.team-select-item.selected .checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
}

.team-select-item .select-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.team-select-item .select-info {
  flex: 1;
}

.team-select-item .select-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}

.team-select-item .select-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.team-select-item .hours-input {
  width: 64px;
  padding: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.team-select-item .hours-input:focus {
  border-color: var(--primary);
}

.hours-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

/* === Split Results === */
.split-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.split-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.split-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}

.split-info {
  flex: 1;
}

.split-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}

.split-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.split-amount {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

/* === Split Summary === */
.split-summary {
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.summary-row.muted {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.summary-amount {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
}

/* === Success === */
.success-card {
  text-align: center;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.success-card h2 {
  margin-bottom: 4px;
}

.sent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  text-align: left;
}

.sent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.sent-item .sent-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.sent-item .sent-amount {
  color: var(--primary);
  font-weight: 700;
}

.sent-item .sent-via {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === History === */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-header h2 {
  margin-bottom: 0;
}

.period-select {
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.history-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.history-date {
  text-align: center;
  min-width: 48px;
}

.history-date .day {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.history-date .date-num {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
}

.history-detail {
  flex: 1;
}

.history-amount {
  display: block;
  font-weight: 700;
  font-size: 1rem;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.history-status.sent {
  background: rgba(16,185,129,0.12);
  color: var(--success);
}

/* === Team List === */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.team-member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.member-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
}

.member-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.member-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.member-stats {
  text-align: right;
}

.member-earned {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

.member-payment {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* === Team Link === */
.team-link-section {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.team-link-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.link-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.link-display span {
  flex: 1;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

.copy-btn {
  padding: 6px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--accent);
  color: white;
}

.team-link-help {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* === Pricing Footer === */
.pricing-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.pricing-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.pricing-card.free {
  background: var(--surface-2);
  color: var(--text-muted);
}

.pricing-card.pro {
  background: var(--primary-dim);
  border: 1px solid rgba(34,197,94,0.3);
}

.plan-name {
  font-weight: 700;
  color: var(--primary);
}

.pricing-card.free .plan-name {
  color: var(--text-muted);
}

.plan-detail {
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* === Animations === */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-panel.active {
  animation: slideIn 0.3s ease;
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.success-icon {
  animation: pop 0.5s ease;
}

/* === Responsive === */
@media (max-width: 380px) {
  .tip-entry-grid {
    grid-template-columns: 1fr;
  }
  
  .history-stats {
    grid-template-columns: 1fr;
  }
  
  .method-pills {
    flex-direction: column;
  }
}
