/* Flat, card-based, mobile-first. Colours come from the PKDS logo: purple ring, saffron robe, deep blue text.
   Large text and 48px tap targets for families new to smartphones. */
:root {
  --brand: #6d2a78;        /* logo ring, darkened for white-text contrast */
  --brand-dark: #4f1d57;
  --brand-soft: #f3e9f5;
  --saffron: #e8891c;
  --saffron-soft: #fdf1e2;
  --ink: #1f1a24;
  --muted: #645d6b;
  --line: #e7e1ec;
  --bg: #f7f5f9;
  --card: #fff;
  --ok: #1e7b4a; --ok-soft: #e5f4ec;
  --warn: #8a5a00; --warn-soft: #fff3d6;
  --err: #b3261e; --err-soft: #fde8e7;
  --radius: 16px;
  --tabbar-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: system-ui, "Noto Sans Devanagari", "Segoe UI", sans-serif; line-height: 1.55;
  color: var(--ink); background: var(--bg); padding-bottom: 2rem;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
img { max-width: 100%; }
.icon { width: 1.3em; height: 1.3em; flex: none; vertical-align: -0.25em; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { width: 40px; height: 40px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand strong { color: var(--brand); font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: .4rem; align-items: center; flex: none; }
.topbar form { margin: 0; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 40px; min-width: 40px;
  padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--brand); font: inherit; font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.chip.solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.icon-only { padding: 0; }

/* Bottom tab bar (logged in) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600; min-width: 0;
}
.tabbar a span:last-child { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.tabbar a[aria-current="page"] { color: var(--brand); }
.tabbar a[aria-current="page"] .icon { stroke-width: 2.6; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 4px); }

/* Layout */
main { max-width: 44rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: .25rem 0 1rem; }
h2 { font-size: 1.12rem; margin: 0 0 .5rem; }
main > h2 { margin: 1.5rem 0 .75rem; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin-bottom: .9rem;
}
a.card { color: inherit; text-decoration: none; }
a.card:active, .profile-card:active { background: var(--brand-soft); }
.row { display: flex !important; justify-content: space-between; align-items: center; gap: .9rem; }
.grow { flex: 1; min-width: 0; }
.row-icon { display: inline-flex; padding: .55rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.hint, small { color: var(--muted); }
.hint { font-size: .9rem; margin: .25rem 0; }
.muted { opacity: .6; }

/* Buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; min-width: 48px;
  padding: .55rem 1.1rem; font: inherit; font-weight: 600; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
}
.primary { width: 100%; margin-top: 1rem; background: var(--brand); color: #fff; font-size: 1.1rem; }
.primary:active { background: var(--brand-dark); }
.primary:disabled { background: #b9aebf; cursor: not-allowed; }
.secondary { background: var(--card); color: var(--brand); border: 1.5px solid var(--brand); }
a.button.primary, a.button.secondary { width: 100%; margin-top: .75rem; }
.problem { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }

/* Forms */
label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
input[type=text], input[type=tel], input[type=number], input[type=email], input[type=date], input:not([type]), select, textarea, input[type=file] {
  width: 100%; min-height: 52px; padding: .55rem .8rem; font: inherit; font-size: 1.05rem; color: var(--ink);
  background: var(--card); border: 1.5px solid #cfc6d6; border-radius: 12px;
}
input[name=mobile], input[name=code] { font-size: 1.3rem; letter-spacing: .06em; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field { margin-bottom: .4rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); }
label.check { display: flex; gap: .75rem; align-items: flex-start; font-weight: 500; }
label.check input { width: 26px; height: 26px; flex: none; accent-color: var(--brand); }
.field div > div > label { display: flex; gap: .6rem; align-items: center; font-weight: 500; margin: .35rem 0; min-height: 44px; }
.field input[type=radio] { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.req { color: var(--err); }
.error { color: var(--err); font-weight: 600; margin: .3rem 0; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: .4rem; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: .25rem; }

/* Status and notices */
.status {
  display: inline-block; padding: .15rem .7rem; border-radius: 999px; background: #eeeaf1; color: var(--muted);
  font-size: .82rem; font-weight: 700; white-space: nowrap;
}
.status-approved { background: var(--ok-soft); color: var(--ok); }
.status-in_review, .status-pending { background: var(--warn-soft); color: var(--warn); }
.status-rejected { background: var(--err-soft); color: var(--err); }
.status-paused { background: #eceff3; color: #4b5563; }
.status-married { background: var(--saffron-soft); color: #9a4f00; }
.notice { background: var(--ok-soft); color: #134f30; padding: .8rem 1rem; border-radius: 12px; margin: 0 0 .9rem; }
.notice.error { background: var(--err-soft); color: #7d1a15; }
.notice.info { background: var(--brand-soft); color: var(--brand-dark); }
.badge {
  display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--saffron); color: #fff;
  font-size: .72rem; line-height: 1.35; text-align: center;
}

/* Home */
.hero { text-align: center; padding: 1rem 0 .5rem; }
.hero img { width: 150px; height: auto; }
.hero p { color: var(--muted); font-size: 1.05rem; }
.features { display: grid; gap: .75rem; margin: 1.25rem 0; }
.feature { display: grid; grid-template-columns: auto 1fr; gap: .1rem .8rem; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.feature .icon { grid-row: span 2; width: 2.4rem; height: 2.4rem; padding: .5rem; border-radius: 12px; background: var(--saffron-soft); color: var(--saffron); }
.feature h2 { font-size: 1rem; margin: 0; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }
@media (min-width: 40rem) { .features { grid-template-columns: repeat(3, 1fr); } .feature { grid-template-columns: 1fr; } .feature .icon { grid-row: auto; } }

/* Profile cards in search */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.profile-grid > .card { grid-column: 1 / -1; }
.profile-card {
  display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: inherit; text-decoration: none;
}
.profile-card img, .profile-card .placeholder { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.placeholder {
  display: flex !important; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand);
  font-size: 2.6rem; font-weight: 700;
}
.placeholder .icon { width: 2.2rem; height: 2.2rem; }
.profile-card-body { display: flex; flex-direction: column; gap: .1rem; padding: .65rem .8rem .8rem; font-size: .88rem; color: var(--muted); }
.profile-card-body strong { color: var(--ink); font-size: 1rem; }
.profile-card-body small { font-size: .78rem; }

/* Photos and details */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.photo { margin: 0; }
.photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; }
.photo figcaption { margin-top: .3rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.photo-actions button { padding: .25rem; flex: 1; min-height: 44px; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; flex: none; }
.locked { display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.details dt { color: var(--muted); font-size: .92rem; }
.details dd { margin: 0; font-weight: 500; }
.details-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.details-table th, .details-table td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.post img { width: calc(100% + 2.5rem); max-width: none; margin: -1.1rem -1.25rem 1rem; border-radius: var(--radius) var(--radius) 0 0; display: block; }
.recorder { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.legal li { margin-bottom: .5rem; }

/* Footer and help */
.footer { max-width: 44rem; margin: 1.5rem auto 0; padding: 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
.footer a { color: inherit; }
.help {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 11; display: inline-flex; align-items: center; gap: .5rem;
  min-height: 52px; padding: 0 1.1rem; border-radius: 999px; background: #1f8f4e; color: #fff; font-weight: 600; text-decoration: none;
}
.has-tabbar .help { bottom: calc(var(--tabbar-h) + .75rem + env(safe-area-inset-bottom)); padding: 0; width: 52px; justify-content: center; }
.has-tabbar .help-text { display: none; }

@media (min-width: 48rem) {
  main { padding: 1.5rem; }
  h1 { font-size: 1.7rem; }
}

/* Advertisement card: clearly set apart from profiles and notices */
.ad-label { display: inline-block; font-size: .75rem; font-weight: 700; color: #9a4f00; background: #fff; border: 1px solid var(--saffron); border-radius: 999px; padding: 0 .6rem; }
.state-picker { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.state-picker label { margin: 0; font-weight: 500; color: var(--muted); white-space: nowrap; }
.state-picker select { min-height: 44px; }

/* Admin panel: its own colour (the deep blue of "PKDS" in the logo) so it never looks like the family screens */
.admin-mode { --brand: #262b8f; --brand-dark: #1a1e66; --brand-soft: #e8e9f7; background: #eef0f6; }
.admin-mode .topbar { background: #262b8f; border-bottom-color: #262b8f; }
.admin-mode .brand strong, .admin-mode .brand small { color: #fff; }
.admin-mode .brand img { background: #fff; border-radius: 50%; padding: 2px; }
.admin-mode .chip { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.admin-mode .tabbar { background: #1a1e66; border-top-color: #1a1e66; }
.admin-mode .tabbar a { color: #b8bce6; }
.admin-mode .tabbar a[aria-current="page"] { color: #fff; }
.admin-mode .help { display: none; }
.section-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.4rem 0 .6rem; }
.todo-grid, .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.todo { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.todo-count { font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--muted); }
.todo-label { font-size: .88rem; font-weight: 600; }
.todo.has-work { border-color: var(--saffron); background: var(--saffron-soft); color: #7a3f00; }
.todo.has-work .todo-count { color: #b35f00; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.tile { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; min-height: 96px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tile .icon { width: 1.8rem; height: 1.8rem; color: var(--brand); }
.stat { display: flex; flex-direction: column; padding: .8rem 1rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.stat strong { font-size: 1.4rem; color: var(--brand); }
.stat span { font-size: .82rem; color: var(--muted); }
.filter-bar { display: grid; gap: .6rem; }
.filter-bar .primary { margin-top: 0; }
@media (min-width: 40rem) { .todo-grid, .tile-grid, .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* Demo profiles (manage.py demo_profiles): clearly not real people */
.demo-badge { align-self: flex-start; background: #fff3d6; color: #8a4b00; border: 1px dashed #e0a030; border-radius: 999px; padding: 0 .5rem; font-size: .75rem; font-weight: 600; }
.demo-notice { background: #fff3d6; border: 1px dashed #e0a030; color: #8a4b00; }

/* Ad carousel (templates/core/_advertisement.html) */
.ad-carousel { position: relative; margin: 1rem 0; --ad-delay: 4.5s; }
.ad-carousel .ad-label { position: absolute; top: .6rem; left: .6rem; z-index: 2; }
.ad-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 18px;
  background: linear-gradient(135deg, var(--saffron-soft), #fff 45%, var(--brand-soft)); border: 1.5px solid #f2d3ad;
  box-shadow: 0 6px 18px rgba(109, 42, 120, .10); }
.ad-track::-webkit-scrollbar { display: none; }
.ad-slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; padding: 2.3rem 2.9rem 1.1rem; min-height: 200px; text-align: center; }
.ad-brand { display: flex; align-items: center; justify-content: center; min-height: 96px; color: var(--ink); text-decoration: none;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1.2), opacity .5s; transform: scale(.88); opacity: .55; }
.ad-slide.on .ad-brand { transform: scale(1); opacity: 1; }
.ad-brand img { max-width: 78%; max-height: 110px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .12)); }
.ad-name { font-size: 1.7rem; font-weight: 800; letter-spacing: .03em; background: linear-gradient(90deg, var(--brand), var(--saffron));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.ad-text { margin: 0; color: var(--muted); font-size: .9rem; max-width: 30ch; }
.ad-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.ad-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 999px; color: #fff; font-weight: 700;
  font-size: .85rem; text-decoration: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transition: transform .15s, box-shadow .15s; }
.ad-btn .icon { width: 1.05rem; height: 1.05rem; }
.ad-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0, 0, 0, .2); }
.ad-btn:active { transform: scale(.94); }
.ad-instagram { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.ad-facebook { background: #1877f2; }
.ad-globe { background: var(--brand); }
.ad-whatsapp { background: #1fa855; }
.ad-phone { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); box-shadow: none; }
.ad-arrow { position: absolute; top: calc(2.3rem + 48px); transform: translateY(-50%); width: 2rem; height: 2rem; min-width: 0; min-height: 0;
  border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); cursor: pointer; }
.ad-arrow.prev { left: .45rem; } .ad-arrow.next { right: .45rem; }
.ad-arrow:active { transform: translateY(-50%) scale(.9); }
.ad-dots { display: flex; justify-content: center; align-items: center; margin-top: .3rem; }
.ad-dots button { min-width: 0; min-height: 0; height: 24px; padding: 0 .2rem; background: none; border: 0; box-shadow: none; cursor: pointer; }
.ad-dots button i { position: relative; display: block; width: .55rem; height: .55rem; border-radius: 999px; background: #dcd2e3; overflow: hidden; transition: width .3s; }
.ad-dots button.on i { width: 1.8rem; }
.ad-dots button i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 0; background: var(--saffron); }
.ad-dots button.on i::after { animation: ad-progress var(--ad-delay) linear forwards; }
.ad-carousel.paused .ad-dots button.on i::after { animation-play-state: paused; }
@keyframes ad-progress { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .ad-brand, .ad-btn, .ad-dots button i { transition: none; }
  .ad-dots button.on i::after { animation: none; width: 100%; }
}
