:root {
  --brand: #C8102E;
  --brand-dark: #970D22;
  --brand-tint: #FBE7E9;
  --ink: #111315;
  --ink-soft: #2A2D31;
  --muted: #6B7280;
  --line: #E4E4E6;
  --bg: #F7F7F8;
  --white: #ffffff;
  --danger: #C8102E;
  --success: #1E8A4C;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  stroke: currentColor;
  fill: none;
}
.icon-sm { width: 0.85em; height: 0.85em; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.link-button:hover { color: var(--brand); }

/* ---------- Topbar / desktop top nav ---------- */

.topbar {
  background: var(--ink);
  color: var(--white);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800;
}
.topbar .brand span.connect { color: var(--brand); }

.topbar .top-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.topbar .top-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.68);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
}
.topbar .top-nav a .icon { width: 18px; height: 18px; }
.topbar .top-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.topbar .top-nav a.active { color: #fff; background: var(--brand); }

.topbar .right-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar .user-name {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  display: none;
}
.topbar a.logout {
  color: var(--white);
  opacity: 0.9;
  font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 7px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar a.logout:hover { opacity: 1; background: rgba(255,255,255,0.08); color: #fff; }
.topbar a.logout { white-space: nowrap; }

@media (max-width: 420px) {
  .topbar { padding: 0 14px; }
  .topbar .brand { font-size: 0.95rem; gap: 6px; }
  .topbar .brand .mark { width: 26px; height: 26px; font-size: 0.72rem; }
  .topbar a.logout { padding: 6px 10px; font-size: 0.76rem; }
  .topbar a.logout .icon { width: 15px; height: 15px; }
}

@media (min-width: 900px) {
  .topbar .top-nav { display: flex; }
  .topbar .user-name { display: inline; }
  .bottom-nav { display: none !important; }
  body.has-nav .page { padding-bottom: 60px; }
}

/* ---------- Bottom nav (mobile) ---------- */

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}
.bottom-nav a .icon { width: 22px; height: 22px; }
.bottom-nav a .tab-mark {
  width: 40px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
}
.bottom-nav a.active { color: var(--ink); }
.bottom-nav a.active .tab-mark { background: var(--brand-tint); color: var(--brand); }

body.has-nav .page { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); }

/* ---------- Layout ---------- */

.page {
  max-width: 460px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  min-height: 100vh;
}

.page.wide { max-width: 760px; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: 0 6px 20px rgba(17, 19, 21, 0.06);
  margin-bottom: 18px;
}

.brand-header {
  text-align: center;
  margin-bottom: 24px;
}

.brand-header .logo-dot {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  margin: 0 auto 12px;
}

.brand-header h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 800;
}

.brand-header p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

h2.card-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

p.card-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

input[type=text], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 16px;
  background: var(--white);
  color: var(--ink);
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 16px;
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.check-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}
.check-pill input { width: auto; margin: 0; accent-color: var(--brand); }
.check-pill:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-dark);
}

.feed-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(17,19,21,0.05);
  margin-bottom: 14px;
}
.feed-item h3 { margin: 0 0 6px; color: var(--ink); font-size: 1rem; }
.feed-item .meta { font-size: 0.76rem; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.feed-item p.body { margin: 0; white-space: pre-line; font-size: 0.92rem; }

input.otp-input {
  letter-spacing: 10px;
  font-size: 1.4rem;
  text-align: center;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--brand);
  color: var(--white);
  border: none;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { background: var(--ink); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--white); }

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--brand-tint); color: var(--brand-dark); }
.alert-success { background: #E9F7EF; color: var(--success); }
.alert-info { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }

.dev-otp-banner {
  background: var(--brand-tint);
  border: 1px dashed var(--brand);
  color: var(--brand-dark);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 18px;
}
.dev-otp-banner strong { font-size: 1.1rem; letter-spacing: 2px; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.profile-tile {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
}
.profile-tile:hover { border-color: var(--brand); }
.profile-tile .avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  margin: 0 auto 10px;
}
.profile-tile .name { font-weight: 600; font-size: 0.9rem; }
.profile-tile .role { font-size: 0.75rem; color: var(--muted); }

.profile-tile.add-new {
  border-style: dashed;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dashboard-hero {
  background: linear-gradient(135deg, var(--ink) 0%, var(--brand-dark) 65%, var(--brand) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 18px;
}
.dashboard-hero .role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.16);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.dashboard-hero h2 { margin: 0 0 4px; font-size: 1.4rem; }
.dashboard-hero p { margin: 0; opacity: 0.85; font-size: 0.88rem; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: 0 4px 14px rgba(17,19,21,0.05);
  height: 100%;
}
.module-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.module-icon .icon { width: 22px; height: 22px; }
.module-card h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--ink); font-weight: 700; }
.module-card p { margin: 0; font-size: 0.8rem; color: var(--muted); }
a.module-card-link { display: block; color: inherit; }
a.module-card-link .module-card { transition: box-shadow 0.15s, transform 0.15s; }
a.module-card-link:hover .module-card { box-shadow: 0 10px 24px rgba(17,19,21,0.12); transform: translateY(-2px); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-dot.live { color: var(--brand); }
.status-dot.soon { color: var(--muted); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) {
  .two-col { grid-template-columns: 1fr; }
}

.link-row {
  text-align: center;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pill-badge .icon { width: 12px; height: 12px; }

.stat-tile { text-align: center; }
.stat-tile .value { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.stat-tile .label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stats-grid .stat-tile {
  background: #fff;
  border-radius: 12px;
  padding: 14px 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.top-list { list-style: none; margin: 0; padding: 0; }
.top-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #eee);
  font-size: 0.9rem;
}
.top-list li:last-child { border-bottom: none; }
.top-list .rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 0.72rem;
  margin-right: 8px;
}

/* ---------- Landing page ---------- */

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1120px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247,247,248,0.85);
  backdrop-filter: blur(8px);
}
.landing-nav .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
}
.landing-nav .brand .mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800;
}
.landing-nav .brand span.connect { color: var(--brand); }
.landing-nav .actions { display: flex; gap: 10px; flex-shrink: 0; }
.landing-nav .actions a.btn { width: auto; padding: 10px 18px; white-space: nowrap; }

@media (max-width: 420px) {
  .landing-nav { padding: 12px 14px; gap: 8px; }
  .landing-nav .brand { font-size: 0.95rem; gap: 6px; }
  .landing-nav .brand .mark { width: 26px; height: 26px; font-size: 0.72rem; }
  .landing-nav .actions { gap: 6px; }
  .landing-nav .actions a.btn { padding: 8px 12px; font-size: 0.82rem; }
}

.landing-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--ink) 0%, var(--brand-dark) 62%, var(--brand) 100%);
  color: #fff;
  padding: 88px 24px 96px;
  text-align: center;
}
.landing-hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 140%;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.10) 0, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(255,255,255,0.08) 0, transparent 45%);
  pointer-events: none;
}
.landing-hero > * { position: relative; }
.landing-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.landing-hero h1 {
  font-size: 2.6rem;
  line-height: 1.14;
  margin: 0 0 18px;
  font-weight: 800;
  max-width: 680px;
  margin-inline: auto;
  text-wrap: balance;
  letter-spacing: -0.5px;
}
.landing-hero p.sub {
  font-size: 1.08rem;
  opacity: 0.85;
  max-width: 540px;
  margin: 0 auto 34px;
  line-height: 1.6;
}
.landing-hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.landing-hero .actions a.btn {
  width: auto; padding: 15px 28px; font-size: 1.02rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.landing-hero .actions a.btn-outline { border-color: rgba(255,255,255,0.55); color: #fff; box-shadow: none; }
.landing-hero .actions a.btn-outline:hover { background: rgba(255,255,255,0.15); }

.landing-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.16);
  max-width: 640px;
  margin: 0 auto;
}
.landing-stats .stat { text-align: center; }
.landing-stats .stat .value { font-size: 1.5rem; font-weight: 800; }
.landing-stats .stat .label { font-size: 0.74rem; opacity: 0.75; margin-top: 2px; }

.landing-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 76px 24px;
}
.landing-section.tint { background: var(--bg); max-width: none; }
.landing-section.tint > div { max-width: 1120px; margin: 0 auto; }
.landing-section .kicker {
  display: block;
  text-align: center;
  color: var(--brand);
  font-weight: 800;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.landing-section h2 {
  text-align: center;
  font-size: 1.75rem;
  margin: 0 0 10px;
  color: var(--ink);
  font-weight: 800;
}
.landing-section > p.lead, .landing-section > div > p.lead {
  text-align: center;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 44px;
  font-size: 1rem;
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  counter-reset: step;
}
.landing-steps .step { text-align: center; position: relative; padding: 0 10px; }
.landing-steps .step .num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  margin: 0 auto 16px;
}
.landing-steps .step h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--ink); }
.landing-steps .step p { margin: 0; font-size: 0.87rem; color: var(--muted); line-height: 1.5; }
@media (min-width: 700px) {
  .landing-steps .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px; left: calc(50% + 45px); right: calc(-50% + 45px);
    height: 2px;
    background: repeating-linear-gradient(to right, var(--line) 0 6px, transparent 6px 12px);
  }
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.landing-grid .feature {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: 0 4px 14px rgba(17,19,21,0.05);
  transition: box-shadow 0.15s, transform 0.15s;
}
.landing-grid .feature:hover { box-shadow: 0 10px 24px rgba(17,19,21,0.1); transform: translateY(-2px); }
.landing-grid .feature .module-icon { margin-bottom: 14px; }
.landing-grid .feature h3 { margin: 0 0 6px; font-size: 1rem; color: var(--ink); }
.landing-grid .feature p { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.landing-cta {
  background: linear-gradient(120deg, var(--brand-dark), var(--brand));
  color: #fff;
  text-align: center;
  padding: 64px 24px;
}
.landing-cta h2 { margin: 0 0 10px; font-size: 1.6rem; font-weight: 800; }
.landing-cta p { margin: 0 0 28px; opacity: 0.88; max-width: 460px; margin-inline: auto; }
.landing-cta a.btn {
  width: auto; padding: 15px 30px; background: #fff; color: var(--brand-dark);
  display: inline-flex;
}
.landing-cta a.btn:hover { background: var(--ink); color: #fff; }

.landing-footer {
  background: var(--ink);
  color: rgba(255,255,255,0.6);
  padding: 40px 24px 24px;
}
.landing-footer .inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.landing-footer .brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; }
.landing-footer .brand .mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 800;
}
.landing-footer .note { max-width: 360px; font-size: 0.85rem; line-height: 1.5; }
.landing-footer .note strong { color: #fff; display: block; margin-bottom: 4px; }
.landing-footer .copyright {
  max-width: 1120px;
  margin: 0 auto;
  padding-top: 18px;
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 700px) {
  .landing-hero { padding: 60px 20px 64px; }
  .landing-hero h1 { font-size: 1.9rem; }
  .landing-section { padding: 56px 20px; }
  .landing-steps { grid-template-columns: 1fr; gap: 32px; }
  .landing-grid { grid-template-columns: 1fr; }
  .landing-footer .inner { flex-direction: column; }
}
