:root {
  --purple: #7A1F2B;
  --purple-dark: #5E1721;
  --purple-light: #F3E6E8;
  --purple-lighter: #F9F1F2;
  --green: #22A559;
  --green-bg: #E7F7EE;
  --amber: #E0A800;
  --amber-bg: #FFF6E0;
  --red: #E0483E;
  --red-bg: #FCEAE9;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --border: #E6E4F5;
  --bg: #FAFAFD;
  --white: #fff;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.phone-frame {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 560px) {
  .phone-frame {
    min-height: 92vh;
    margin-top: 4vh;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(30,20,80,0.15);
    overflow: hidden;
    border: 1px solid var(--border);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text);
}
.icon-btn:not(.spacer):active { background: var(--purple-light); }
.icon-btn.spacer { visibility: hidden; }

.content {
  flex: 1;
  padding: 18px 16px 90px;
  overflow-y: auto;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 4px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: #E9E9F0; color: var(--text-muted);
}
.step-active .step-dot { background: var(--purple); color: #fff; }
.step-done .step-dot { background: var(--purple); color: #fff; }
.step-label { font-size: 11px; color: var(--text-muted); }
.step-active .step-label { color: var(--purple); font-weight: 600; }
.step-line { flex: 1 1 24px; height: 2px; background: var(--border); margin: 0 4px; margin-bottom: 16px; max-width: 40px; }

/* Headings & text */
h2.page-heading { font-size: 22px; margin: 4px 0 4px; }
p.page-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
label.field-label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: var(--text); }
label.field-label:first-child { margin-top: 0; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.greeting-card h2 { margin: 0 0 4px; font-size: 22px; }
.greeting-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

.stats-card { padding: 4px 16px; }
.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-row .stat-label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.stat-row .stat-icon { width: 20px; text-align: center; color: var(--purple); }
.stat-row .stat-value { font-weight: 700; font-size: 15px; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:active { background: var(--purple-dark); }
.btn-outline { background: #fff; color: var(--purple); border: 1.5px solid var(--purple); }
.btn-block + .btn-block { margin-top: 10px; }
.btn-sm { width: auto; padding: 8px 16px; font-size: 13px; display: inline-block; }
.btn-danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; }

/* Choice tiles (task type grid) */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 20px;
}
.tile {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tile .tile-icon { font-size: 26px; display: block; margin-bottom: 10px; color: var(--purple); }
.tile.selected { border-color: var(--purple); background: var(--purple-lighter); color: var(--purple); }
.tile input { display: none; }

/* Forms */
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: #fff;
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--purple); }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-with-icon { position: relative; }
.input-with-icon .field-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}
.input-with-icon .form-control { padding-left: 36px; }
.row-2 { display: flex; gap: 10px; }
.row-2 > div { flex: 1; }
.row-2-unit { display: flex; align-items: center; gap: 10px; }
.row-2-unit .form-control { text-align: center; }
.unit-label { font-size: 13px; color: var(--text-muted); min-width: 32px; }

/* Review list */
.review-list .review-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.review-list .review-row:last-child { border-bottom: none; }
.review-row .review-icon { color: var(--purple); width: 18px; text-align: center; padding-top: 2px; }
.review-row .review-label { font-size: 12px; color: var(--text-muted); }
.review-row .review-value { font-size: 14.5px; font-weight: 600; }

/* Status badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-rejected { background: var(--red-bg); color: var(--red); }

/* List rows (My Tasks) */
.list-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  display: block;
}
.list-row-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.list-row-title { font-weight: 700; font-size: 14.5px; }
.list-row-sub { font-size: 12.5px; color: var(--text-muted); }
.list-row-meta { display: flex; gap: 14px; margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }

/* Success screen */
.success-wrap { text-align: center; padding: 30px 10px 10px; }
.success-circle {
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin: 0 auto 20px;
}
.success-wrap h2 { margin: 0 0 8px; font-size: 22px; }
.success-wrap p { color: var(--text-muted); margin: 0 0 26px; }

/* Bottom nav */
.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
  padding: 4px 0;
}
.nav-item .nav-icon { font-size: 19px; }
.nav-item.active { color: var(--purple); font-weight: 700; }

/* Info banner */
.info-banner {
  display: flex; gap: 10px;
  background: var(--purple-lighter);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.info-banner .info-icon { color: var(--purple); flex: 0 0 auto; }

/* Login */
.login-wrap { padding-top: 30px; }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .logo-badge {
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--purple); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; margin: 0 auto 14px;
}
.login-logo h2 { margin: 0; }
.error-banner { background: var(--red-bg); color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.form-links { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--text-muted); }

/* Admin table */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.filter-chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: #fff; border: 1.5px solid var(--border); color: var(--text-muted);
  white-space: nowrap;
}
.filter-chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }

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

select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
