:root {
  --bg: #eef3fc;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #e3ecfb;
  --border: rgba(37, 99, 235, 0.10);
  --border-strong: rgba(37, 99, 235, 0.22);
  --text-primary: #0f1b33;
  --text-secondary: #5b6b85;
  --text-tertiary: #93a0b8;
  --accent-blue: #2563eb;
  --accent-green: #16a34a;
  --accent-orange: #d97706;
  --accent-red: #dc2626;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --accent-teal: #0d9488;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  background: #dbe6f7;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
}

.device {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* status bar (used by policy.html) */
.status-bar {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.dynamic-island {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 24px;
  background: #000;
  border-radius: 14px;
}

.sb-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
}

.sb-5g {
  font-size: 12px;
  font-weight: 700;
}

/* screens */
.screens {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 100px;
  scrollbar-width: none;
}

.screens::-webkit-scrollbar {
  display: none;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 4px;
}

.app-header.simple {
  padding-top: 14px;
  padding-bottom: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
}

.brand svg {
  color: var(--accent-blue);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text-primary);
}

.screen-title {
  font-size: 24px;
  margin: 4px 0 2px;
  color: var(--text-primary);
}

.screen-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 18px;
}

.greeting {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 10px 0 0;
}

/* stat row */
.stat-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  cursor: default;
}

.stat-card-link {
  cursor: pointer;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-blue { background: rgba(37, 99, 235, 0.12); color: var(--accent-blue); }
.stat-icon-orange { background: rgba(217, 119, 6, 0.12); color: var(--accent-orange); }
.stat-icon-green { background: rgba(22, 163, 74, 0.12); color: var(--accent-green); }
.stat-icon-red { background: rgba(220, 38, 38, 0.12); color: var(--accent-red); }

.stat-card-top strong {
  font-size: 20px;
  color: var(--text-primary);
}

.stat-card-top strong.up {
  color: var(--accent-green);
}

.stat-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* buttons */
.quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.btn {
  flex: 1;
  min-height: 46px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-ghost {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

/* blocks */
.block {
  margin-bottom: 24px;
}

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

.block-title {
  font-size: 16px;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.block-head .block-title {
  margin-bottom: 0;
}

.block-text {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.reason-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.reason-list li {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 28px;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.reason-list li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
}

/* feed */
.feed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 14px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.feed[hidden] {
  display: none;
}

.feed-compact {
  margin-bottom: 0;
}

.feed-item {
  display: flex;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.feed-item p {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.feed-item p.strong {
  font-weight: 700;
}

.feed-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state[hidden] {
  display: none;
}

.empty-state p {
  margin: 0;
  max-width: 220px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
}

.dot-green { background: var(--accent-green); }
.dot-orange { background: var(--accent-orange); }
.dot-blue { background: var(--accent-blue); }
.dot-purple { background: var(--accent-purple); }
.dot-red { background: var(--accent-red); }

.dot.pulse {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* requests */
.chip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.new-request-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.new-request-form[hidden] {
  display: none;
}

.form-input {
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 14px;
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

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

.new-request-actions .btn {
  flex: 1;
}

.status-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.status-legend[hidden] {
  display: none;
}

.status-legend-item {
  display: flex;
  gap: 10px;
}

.status-legend-item .dot {
  margin-top: 4px;
}

.status-legend-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.status-legend-desc {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.request-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.request-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.request-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.request-delete {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.12);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.request-delete:hover {
  background: rgba(220, 38, 38, 0.2);
}

.request-id {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
}

.request-merchant {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.request-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.request-bottom strong {
  font-size: 16px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-blue { background: rgba(79, 140, 255, 0.15); color: var(--accent-blue); }
.badge-orange { background: rgba(245, 166, 35, 0.15); color: var(--accent-orange); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* chart */
.chart-block .block-head {
  margin-bottom: 16px;
}

.trend-up {
  color: var(--accent-green);
  font-weight: 700;
  font-size: 13px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 110px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px 10px;
}

.bar {
  flex: 1;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.5), rgba(79, 140, 255, 0.1));
}

.bar.highlight {
  background: linear-gradient(180deg, #34d399, #0f9d73);
}

.bar.decline {
  background: linear-gradient(180deg, #f87171, #b91c1c);
}

.bars-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 6px 10px 0;
}

.chart-disclaimer {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

/* reviews */
.reviews {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.review-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.review-who {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
}

.verified {
  color: var(--accent-blue);
}

.stars {
  color: var(--accent-orange);
  font-size: 12px;
  letter-spacing: 1px;
}

.review-amount {
  color: var(--accent-green);
  font-size: 14px;
}

.review-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.review-card p.strong {
  color: var(--text-primary);
  font-weight: 700;
}

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.avatar-blue { background: linear-gradient(135deg, #4f8cff, #2f5fd1); }
.avatar-pink { background: linear-gradient(135deg, #ec4899, #be185d); }
.avatar-indigo { background: linear-gradient(135deg, #6366f1, #3730a3); }
.avatar-teal { background: linear-gradient(135deg, #14b8a6, #0d7d70); }
.avatar-purple { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }

/* profile */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.profile-avatar {
  width: 52px;
  height: 52px;
}

.profile-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.profile-status {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-contact-section,
.profile-payment-section {
  display: none;
}

.settings-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-link {
  cursor: pointer;
}

.chevron {
  color: var(--text-tertiary);
  font-size: 18px;
}

.lang-switch {
  display: flex;
  gap: 6px;
  background: var(--bg-elevated-2);
  border-radius: 999px;
  padding: 3px;
}

.lang-switch button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--accent-blue);
  color: #fff;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: var(--bg-elevated-2);
  position: relative;
  cursor: pointer;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle.on {
  background: rgba(34, 197, 94, 0.3);
}

.toggle.on .toggle-knob {
  transform: translateX(18px);
  background: var(--accent-green);
}

/* modal */
.modal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 27, 51, 0.45);
  z-index: 20;
}

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

.modal-card {
  width: 100%;
  max-width: 320px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(15, 27, 51, 0.25);
}

.modal-card p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  text-align: center;
}

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

.modal-actions .btn {
  flex: 1;
}

.policy-modal-card {
  max-width: 360px;
  background: var(--bg-elevated);
  padding: 22px 20px 20px;
  box-shadow: 0 24px 60px rgba(37, 99, 235, 0.22);
}

.policy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.policy-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.policy-modal-close {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
}

.policy-modal-box {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.policy-modal-card .policy-modal-box p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: left;
}

.policy-modal-card .policy-modal-effective {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: left;
}

.policy-modal-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: var(--accent-blue);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  margin-bottom: 12px;
}

.policy-modal-card .policy-modal-caption {
  margin: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

/* bottom nav */
.bottom-nav {
  flex: none;
  display: flex;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  padding: 8px 4px 4px;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 10.5px;
  padding: 4px 0;
  cursor: pointer;
  position: relative;
}

.nav-item.active {
  color: var(--accent-blue);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-blue);
}

.home-indicator {
  flex: none;
  width: 134px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 27, 51, 0.25);
  margin: 6px auto 8px;
}
