/* DADCARE Mother App shell and authentication pages. */

body.shell { padding-bottom: 0; }

.hero { background: linear-gradient(160deg, var(--brand-soft), var(--bg)); }
.hero-in { max-width: 1100px; margin: 0 auto; padding: 14px 16px 26px; }
.hero-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.logo { font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.hero-top .spacer { flex: 1; }
.hero h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 16px; max-width: 46ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
@media (min-width: 720px) { .hero h1 { font-size: 34px; } }

.btn.small { min-height: 38px; padding: 8px 12px; font-size: 14px; }

.welcome { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.welcome > div:first-child { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 12px; }

.section { font-size: 14px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 18px 0 10px; }

.apps { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .apps { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .apps { grid-template-columns: repeat(4, 1fr); } }

.app {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 14px 16px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); min-height: 168px;
  justify-content: flex-start;
  transition: border-color .15s ease, transform .15s ease;
}
.app .nm { font-weight: 650; font-size: 15px; line-height: 1.25; }
/* Descriptive only. No tile ever carries a count, rating or statistic. */
.app .ds { font-size: 12px; line-height: 1.35; color: var(--muted);
  flex: 1; display: block; }
.app .badge { margin-top: auto; }
@media (hover: hover) {
  a.app:hover { border-color: var(--brand); transform: translateY(-1px); }
}
/* A coming-soon tile must not look like something you can use: it is not a
   link, it does not lift on hover, and its state is stated plainly. */
.app.disabled { cursor: not-allowed; background: var(--surface); border-style: dashed; }
.app.disabled .nm, .app.disabled .ds { color: var(--muted); }
/* The identity is kept — only its intensity drops — so a coming-soon app is
   still recognisably itself without looking usable. */
.app.disabled .app-ico { opacity: .55; }
.app.disabled .badge { background: var(--surface-2); color: var(--muted); }

.shell-foot {
  margin-top: 26px; padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between;
}

/* Authentication pages */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 26px 16px 40px; }
.auth-brand { display: block; text-align: center; font-weight: 800; font-size: 20px;
  color: var(--text); margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin: 0 0 14px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; }
.auth-lang { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* Context-aware shell */
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: 12px;
  color: var(--brand-dark); font-weight: 700; margin: 0 0 6px; }
.btn-lead { font-size: 16px; padding: 13px 22px; }
.app-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.switch-form { margin: 0; }
.switch-form button.row { cursor: pointer; text-align: left; font: inherit; color: inherit; }

/* ── Way out of a mini-app ─────────────────────────────────────────────────
   My Business is a room inside DADCARE, and every room needs a door. This is
   it: one labelled link in the shared My Business header, present on every
   screen, going to the Mother App's Marketplace Home. It is deliberately named
   rather than a bare glyph - an unexplained icon is not an exit. It reads no
   permission and changes no state, so it is offered to everybody the shell is
   already showing. */
.mother-return {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 6px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.mother-return .ic { width: 18px; height: 18px; }
@media (hover: hover) { .mother-return:hover { background: var(--brand-soft);
  color: var(--brand-dark); } }
/* With the door in the header, the heading is what gives up width first, and
   on a narrow phone the row wraps rather than pushing the page sideways - the
   same answer the Marketplace header already gives to the same problem. */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.topbar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }

/* ── Shell header ──────────────────────────────────────────────────────────
   A shop's header, not a dashboard's: the DADCARE name, a little breathing
   room, and whatever one action the page needs. It is deliberately short —
   on a phone the header is height taken away from the products. */
.shell .mk-top { display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; min-height: 52px; }
.shell .mk-top .mk-brand { font-size: 17px; font-weight: 800;
  letter-spacing: .01em; color: var(--text); }
.shell .mk-top .spacer { flex: 1; }

/* ── Global navigation: Home | Apps | Active | Inbox | Me ─────────────────── */
body.has-nav { padding-bottom: 78px; }

.globalnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.globalnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; min-height: var(--tap);
  color: var(--muted); font-size: 11px; border-radius: 12px; padding: 7px 2px;
  /* Weight is reserved on both states so the active tab cannot shift layout. */
  font-weight: 600; text-decoration: none;
}
.globalnav a .lb { line-height: 1; letter-spacing: .01em; }
.globalnav a.active { color: var(--brand-dark); background: var(--brand-soft); }

/* Same information architecture rendered as a side rail on wider screens.
   Identical destinations and meanings — no separate desktop product logic. */
@media (min-width: 900px) {
  body.has-nav { padding-bottom: 0; padding-left: 210px; }
  .globalnav {
    top: 0; right: auto; width: 210px; bottom: 0;
    flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--border);
    padding: 74px 12px 12px; gap: 4px;
  }
  .globalnav a { flex: none; flex-direction: row; justify-content: flex-start;
    gap: 12px; font-size: 15px; padding: 11px 12px; }
  .mk-top, .shell .mk-top { padding-left: 226px; }
}

.continue-card { border-color: var(--brand); }
.app-group { margin-top: 6px; }
.me-list .row { text-decoration: none; }


/* ── DADCARE icon system ──────────────────────────────────────────────────
   One inline SVG sprite drawn on currentColor. No emoji: emoji are another
   vendor's artwork and differ on every device. No image files and no icon
   library, so navigation costs no extra request. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic { width: 24px; height: 24px; display: block; flex: none; }

.app-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  background: var(--a-app-soft); color: var(--a-app);
}
/* Mini App identities. Visual only — a colour never means "you may open this";
   availability comes from the registry and shows as the card's state badge. */
.a-business    { background: var(--a-business-soft);    color: var(--a-business); }
.a-marketplace { background: var(--a-marketplace-soft); color: var(--a-marketplace); }
.a-school      { background: var(--a-school-soft);      color: var(--a-school); }
.a-pharmacy    { background: var(--a-pharmacy-soft);    color: var(--a-pharmacy); }
.a-gym         { background: var(--a-gym-soft);         color: var(--a-gym); }
.app-ico .ic { width: 26px; height: 26px; }
.app-ico.lead { width: 44px; height: 44px; margin-right: 12px; }
.app-ico.sm { width: 38px; height: 38px; border-radius: 11px; margin-right: 10px; }
.app-ico.sm .ic { width: 22px; height: 22px; }
.mk-brand { display: inline-flex; align-items: center; gap: 8px; }
.topbar .app-ico.sm { margin-right: 0; }



/* ── Preference chips (Appearance, Language) ───────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 40px;
}
.chip.on {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark);
}

/* ── Language settings ─────────────────────────────────────────────────────
   A language is chosen by identity, not by country: the flag is a visual mark
   for the language itself, and the code that is stored is a language code. */
.langs { display: grid; gap: 8px; }
.lang-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; min-height: var(--tap); cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit;
}
.lang-card .grow { display: flex; flex-direction: column; gap: 1px; }
.lang-flag {
  width: 30px; height: 20px; flex: none; border-radius: 3px;
  border: 1px solid var(--border);
}
.lang-name { font-weight: 600; }
.lang-sub { color: var(--muted); font-size: 13px; }
.lang-tick { flex: none; color: var(--brand); opacity: 0; }
.lang-tick .ic { width: 20px; height: 20px; }
.lang-card.on { border-color: var(--brand); background: var(--brand-soft); }
.lang-card.on .lang-tick { opacity: 1; }
@media (hover: hover) { .lang-card:hover { border-color: var(--brand); } }

/* ── Marketplace Home: a public storefront ─────────────────────────────────
   A shop window, laid out the way a phone shopper reads one: search, then the
   categories that actually exist, then products in a grid where the picture
   is the biggest thing on the card.

   Everything is a normal block in normal document flow. Ordinary scrolling
   reaches every product, nothing depends on a gesture, and each card is a
   link and a button rather than a swipe target. */

/* Search. One field, because there is one thing to search. */
.mksearch { position: relative; margin: 4px 0 12px; }
.mksearch .ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--muted); pointer-events: none;
}
.mksearch input {
  width: 100%; min-height: var(--tap); padding: 11px 14px 11px 40px;
  background: var(--surface); color: var(--text); font: inherit;
  border: 1px solid var(--border); border-radius: 999px;
}
.mksearch input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Category chips. Horizontally scrollable on a phone, which is the only way a
   row of real category names fits; the bar itself is hidden rather than
   invented when the catalogue has no categories in it yet. */
.chiprow {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px;
  padding: 2px 16px 6px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.chiprow::-webkit-scrollbar { display: none; }
.chiprow .chip { flex: none; white-space: nowrap; scroll-snap-align: start; }

/* Section heading. One line, sentence case, no management vocabulary. */
.mksection {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px;
  font-size: 17px; font-weight: 700; color: var(--text);
}
.mksection .count { font-size: 13px; font-weight: 600; color: var(--muted); }

/* The product grid. Two columns is the phone default because a shopper
   comparing things wants two in view; below 360px one column wins, since a
   half-width card at that size stops being readable. */
.pgrid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 359px) { .pgrid { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 700px) { .pgrid { gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .pgrid {
  grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pcard {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px;
}
/* Media, then words. The picture is the card. */
.pcard-open { display: block; color: inherit; min-width: 0; }
.pcard-media {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  background: var(--surface-2);
}
.pcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimage {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 12px; text-align: center;
  color: var(--muted); font-size: 13px; line-height: 1.3;
}
/* Sits on the picture, so the price stays the loudest thing in the words. */
.pcard-kind {
  position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); color: var(--brand-dark); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.pcard-video {
  position: absolute; right: 8px; top: 8px; display: flex; align-items: center;
  gap: 4px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 11px; font-weight: 700;
}
.pcard-video .ic { width: 13px; height: 13px; }

.pcard-body { padding: 10px 12px 12px; display: grid; gap: 3px; min-width: 0; }
.pcard-name {
  margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcard-price {
  margin: 2px 0 0; font-size: 16px; font-weight: 800; color: var(--text);
  overflow-wrap: anywhere;
}
.pcard-price .cur { font-size: 12px; font-weight: 700; color: var(--muted);
  margin-right: 3px; }
.pcard-where {
  margin: 0; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The one buyer action DADCARE actually has. */
.pcard-wa {
  margin: 10px 12px 12px; min-height: 38px; font-size: 13px; padding: 8px 10px;
  background: var(--surface); color: var(--brand-dark); border-color: var(--brand);
  font-weight: 700;
}
.pcard-wa:active { background: var(--brand-soft); }
@media (hover: hover) {
  .pcard:hover { border-color: var(--brand); }
}

/* One listing, at its own public address. A card crops to a square so a grid
   reads as a grid; this page does not, because here the photograph is the
   product and cropping it would hide part of what is being sold. */
.listing { display: grid; gap: 6px; max-width: 640px; }
.listing h1 { font-size: 22px; line-height: 1.25; margin: 8px 0 0; }
.listingmedia {
  width: 100%; border-radius: 16px; display: block; background: var(--surface-2);
}
.postname { font-size: 17px; font-weight: 700; margin: 0; }
.postprice { font-size: 24px; font-weight: 800; color: var(--text); margin: 2px 0; }
.postprice .cur { font-size: 14px; font-weight: 700; color: var(--muted); }
.postdesc { color: var(--text); margin: 0; overflow-wrap: anywhere; }
.postwhere { color: var(--muted); font-size: 14px; margin: 0; }
.tag {
  justify-self: start; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 13px; font-weight: 600;
}

/* The central post action. Prominent, and still a labelled link. */
.globalnav a.post .postmark {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand);
  font-size: 22px; line-height: 1; font-weight: 600;
}

/* What the seller chose, shown back to them before they publish. */
.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.previewitem { margin: 0; width: 84px; }
.previewitem img {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.previewitem figcaption {
  font-size: 11px; color: var(--muted); overflow-wrap: anywhere;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
