:root {
  --bg: #1f2121;
  --surface: #262828;
  --surface-2: #2c2f2f;
  --surface-hover: #303434;
  --text: #f5f5f5;
  --muted: rgba(245,245,245,.62);
  --muted-2: rgba(245,245,245,.42);
  --border: rgba(167,169,169,.25);
  --teal: #32b8c6;
  --teal-soft: rgba(50,184,198,.08);
  --teal-border: rgba(50,184,198,.46);
  --gold: #ffd700;
  --shadow: 0 16px 44px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -16%, rgba(50,184,198,.10), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

a { color: inherit; }

.shell {
  width: min(920px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px calc(26px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 12px 2px 34px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-home-link {
  display: inline-flex;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(50,184,198,.55);
  box-shadow: 0 0 20px rgba(50,184,198,.18);
  color: var(--teal);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.03em;
  transform: translateY(-1px);
}

.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .card-label {
  color: var(--teal);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .14em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 5px;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.025em;
  font-weight: 800;
}
.brand-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.private-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(50,184,198,.7);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 12px;
}
.section-head h2 {
  margin: 3px 0 0;
  font-size: 20px;
  letter-spacing: -.025em;
}
.app-count {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 750;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.app-card {
  min-height: 252px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.008)), var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-card[href]:hover {
  transform: translateY(-3px);
  border-color: rgba(50,184,198,.55);
  background: var(--surface-hover);
  box-shadow: 0 20px 48px rgba(0,0,0,.27);
}
.app-card[href]:active { transform: translateY(-1px) scale(.997); }

.app-card--finance { border-top-color: rgba(255,215,0,.35); }
.app-card--calculator { border-top-color: rgba(50,184,198,.68); }

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 35px;
}
.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  border: 1px solid rgba(50,184,198,.23);
}
.app-card--finance .app-icon {
  background: rgba(255,215,0,.055);
  border-color: rgba(255,215,0,.17);
}
.app-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-card--finance .app-icon svg { stroke: var(--gold); }
.open-mark {
  color: var(--muted-2);
  font-size: 22px;
  font-weight: 500;
  transition: color .18s ease, transform .18s ease;
}
.app-card[href]:hover .open-mark {
  color: var(--teal);
  transform: translate(2px,-2px);
}

.card-copy { flex: 1; }
.card-copy h3, .app-card--future h3 {
  margin: 6px 0 8px;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.card-copy p, .app-card--future p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 42ch;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 15px;
  border-top: 1px solid rgba(167,169,169,.15);
}
.status, .launch {
  font-size: 11px;
  font-weight: 750;
}
.status {
  color: var(--muted-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
}
.launch { color: var(--teal); white-space: nowrap; }

.app-card--future {
  grid-column: 1 / -1;
  min-height: 118px;
  box-shadow: none;
  border-style: dashed;
  background: rgba(255,255,255,.012);
  flex-direction: row;
  align-items: center;
  gap: 17px;
  color: var(--muted);
}
.app-card--future .card-label { color: var(--muted-2); }
.app-card--future h3 { color: rgba(245,245,245,.72); font-size: 17px; margin-bottom: 4px; }
.app-card--future p { font-size: 12px; }
.future-plus {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  font-size: 25px;
  font-weight: 300;
  color: var(--muted-2);
}

.footer {
  margin-top: auto;
  padding: 26px 2px 4px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 650;
  display: flex;
  justify-content: center;
  gap: 7px;
}
.footer-sep { color: rgba(50,184,198,.48); }

@media (max-width: 680px) {
  .shell { padding-left: 14px; padding-right: 14px; }
  .hero { padding-bottom: 28px; }
  .private-badge { display: none; }
  .brand-mark { width: 46px; height: 46px; flex-basis: 46px; font-size: 16px; }
  .brand-row { gap: 12px; }
  h1 { font-size: 25px; }
  .brand-copy p { font-size: 13px; }
  .app-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 232px; padding: 18px; border-radius: 18px; }
  .app-card--future { grid-column: auto; min-height: 108px; }
  .card-topline { margin-bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-card, .open-mark { transition: none; }
}


/* ============================================================
   iPhone / installed web-app polish
   ============================================================ */
html {
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior: none;
  touch-action: manipulation; /* blocks double-tap zoom, keeps pinch zoom */
}
body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

button, a, [role="button"] {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.app-card {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.shell {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

@media (max-width: 680px) {
  .shell {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

@media (hover: none) {
  .app-card[href]:hover {
    transform: none;
    border-color: var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.008)), var(--surface);
    box-shadow: var(--shadow);
  }
  .app-card--finance[href]:hover { border-top-color: rgba(255,215,0,.35); }
  .app-card--calculator[href]:hover { border-top-color: rgba(50,184,198,.68); }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero { padding-top: 4px; padding-bottom: 18px; }
  .app-card { min-height: 205px; }
  .card-topline { margin-bottom: 20px; }
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}


/* ============================================================
   v2 iPhone spacing polish
   ============================================================ */
.shell {
  padding-top: max(32px, calc(env(safe-area-inset-top) + 10px));
}
html.is-standalone .shell {
  padding-top: calc(env(safe-area-inset-top) + 12px);
}


/* v4 shared RM internal-app typography */
body {
  font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size:16px;
  font-weight:400;
  font-synthesis:none;
}
button, input, select, textarea { font-family:inherit; }


/* ============================================================
   v5 final iPhone spacing + compact hub
   ============================================================ */
/* Give every installed page a little more air below the iPhone status area. */
.shell {
  padding-top:max(36px, calc(env(safe-area-inset-top) + 14px));
}
html.is-standalone .shell {
  padding-top:calc(env(safe-area-inset-top) + 16px);
}

/* Keep the launcher intentionally quieter than the apps themselves. */
.hero { padding-top:8px; padding-bottom:24px; }
.section-head { padding-bottom:10px; }
.app-card {
  min-height:208px;
  padding:18px;
}
.card-topline { margin-bottom:20px; }
.app-icon { width:44px; height:44px; border-radius:13px; }
.app-icon svg { width:23px; height:23px; }
.card-copy h3 { margin:5px 0 6px; font-size:22px; }
.card-copy p { font-size:12px; line-height:1.4; }
.card-footer { margin-top:20px; padding-top:12px; }
.footer { padding-top:20px; }

@media (max-width:680px) {
  .hero { padding-bottom:22px; }
  .app-card { min-height:176px; padding:16px; }
  .card-topline { margin-bottom:14px; }
  .card-copy h3 { font-size:21px; }
  .card-footer { margin-top:15px; padding-top:11px; }
  .footer { padding-top:16px; }
}

/* ============================================================
   v7 exact iPhone top alignment with Business Manager
   ============================================================ */
.shell {
  padding-top:max(40px, calc(env(safe-area-inset-top) + 20px));
}
html.is-standalone .shell {
  padding-top:calc(env(safe-area-inset-top) + 22px);
}



/* ============================================================
   FINAL polish — keep footer visually attached to the launcher
   ============================================================ */
.footer {
  margin-top:8px;
  padding-top:8px;
}
@media (max-width:680px) {
  .footer {
    margin-top:6px;
    padding-top:6px;
  }
}

/* ============================================================
   FINAL header optical alignment — Hub logo matches internal apps
   ============================================================ */
/* The Hub copy has a subtitle, so centering the logo against the whole
   copy block makes the RM badge sit too low. Align it to the title block. */
.brand-row {
  align-items: flex-start;
}
.brand-home-link {
  align-self: flex-start;
  transform: translateY(-3px);
}
/* Keep the badge itself neutral; positioning belongs to the link wrapper. */
.brand-mark {
  transform: none;
}


/* ============================================================
   Third application + compact 3-app launcher
   ============================================================ */
.app-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.app-card--vat {
  border-top-color: rgba(255,215,0,.48);
}
.app-card--vat .app-icon {
  background: rgba(255,215,0,.055);
  border-color: rgba(255,215,0,.18);
}
.app-card--vat .app-icon svg {
  stroke: var(--gold);
}
@media (hover: none) {
  .app-card--vat[href]:hover { border-top-color: rgba(255,215,0,.48); }
}

@media (max-width: 900px) and (min-width: 681px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .hero { padding-bottom: 18px; }
  .section-head { padding-bottom: 8px; }
  .app-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .app-card {
    min-height: 174px;
    padding: 15px;
  }
  .card-topline { margin-bottom: 10px; }
  .app-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .app-icon svg {
    width: 21px;
    height: 21px;
  }
  .card-copy h3 {
    margin: 4px 0 5px;
    font-size: 20px;
  }
  .card-copy p {
    font-size: 11.5px;
    line-height: 1.35;
  }
  .card-footer {
    margin-top: 12px;
    padding-top: 9px;
  }
  .footer {
    margin-top: 4px;
    padding-top: 5px;
  }
}
