/* =========================================================
   Mekudeshet — the matchmaker portal.

   Deliberately not the marketing site's stylesheet. This is the same tool the
   iOS app is, on a bigger screen: the tokens below are lifted from
   ios/Mekudeshet/Theme/Theme.swift so a shadchan moving between phone and
   laptop is looking at one product, not two.

   Layout follows the same rule as the app — a bottom tab bar on a phone, and
   the same four destinations as a rail once there's room for one.
   ========================================================= */

:root {
  /* One plum accent. No gradients, no gold, no glow. */
  --accent: #6E4067;
  --accent-pressed: #5A3354;
  --accent-soft: #F0E9EF;

  --ink: #18141A;
  --ink-2: #6E6873;
  --ink-3: #A8A2AD;

  --bg: #FBFAFB;
  --card: #ffffff;
  --fill: #F2F0F3;
  --line: #ECE8EC;

  /* Colour carries state: green is settled, amber is waiting on a person. */
  --ok: #1E9E54;
  --ok-soft: #E7F4EC;
  --wait: #9A6A12;
  --wait-soft: #FAF1DE;
  --stop: #A33A2B;
  --stop-soft: #F8EBE8;
  --whatsapp: #25D366;

  --r: 16px;
  --r-sm: 12px;
  --r-xs: 10px;
  --shadow: 0 10px 30px -18px rgba(24, 20, 26, .35);
  --tabbar: 74px;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #C9A5C2; --accent-pressed: #B892B1; --accent-soft: #2A2130;
    --ink: #F2EFF3; --ink-2: #A9A2AE; --ink-3: #776F7C;
    --bg: #141116; --card: #1C181E; --fill: #241F26; --line: #2B252D;
    --ok: #57C486; --ok-soft: #17301F; --wait: #D9A854; --wait-soft: #322813;
    --stop: #DE8A75; --stop-soft: #37211C;
  }
}

* , *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }

.hidden { display: none !important; }
.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;
}

/* ---------- Shell ---------- */

#shell { min-height: 100%; display: flex; flex-direction: column; }

.rail { display: none; }

.screen {
  flex: 1;
  padding: 20px 20px calc(var(--tabbar) + 28px);
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

/* The app's TabHeader: a big left-aligned title with one trailing control. */
.screen-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.screen-head h1 { font-size: 30px; font-weight: 700; }
.screen-head .sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.head-actions { display: flex; gap: 10px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); color: var(--accent);
  transition: transform .12s, background .12s;
}
.icon-btn:active { transform: scale(.96); }
.icon-btn.filled { background: var(--accent); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { .icon-btn.filled { color: #1a1520; } }

/* ---------- Tab bar (phone) ---------- */

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px;
  width: min(440px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px; z-index: 40; box-shadow: var(--shadow);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0; border-radius: 999px;
  color: var(--ink-2); font-size: 11px; font-weight: 500;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.tabbar .badge {
  position: absolute; transform: translate(14px, -6px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--wait); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- Cards, rows, chips ---------- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.card.pad { padding: 18px; }
.card + .card { margin-top: 14px; }

.rows > * + * { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; width: 100%; text-align: left; color: inherit;
}
.row:hover { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .meta { font-size: 13px; color: var(--ink-2); }
.row .chev { color: var(--ink-3); flex-shrink: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  background: var(--fill); color: var(--ink-2); font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #1a1520; } }
.chip .n { font-size: 11px; font-weight: 700; opacity: .75; margin-left: 4px; }

.section-head { font-size: 15px; font-weight: 600; margin: 22px 0 8px; }
.section-note { font-size: 13px; color: var(--ink-2); margin: -4px 0 10px; }

/* ---------- Avatars, badges ---------- */

.avatar {
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; flex-shrink: 0;
  width: 46px; height: 46px; font-size: 15px; overflow: hidden;
}
.avatar.lg { width: 92px; height: 92px; font-size: 30px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--fill); color: var(--ink-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.wait { background: var(--wait-soft); color: var(--wait); }
.badge.stop { background: var(--stop-soft); color: var(--stop); }

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: 14px; font-weight: 600; font-size: 15px;
  background: var(--fill); color: var(--ink); transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #1a1520; } }
.btn.ok { background: var(--ok); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 14px; font-size: 13.5px; border-radius: 10px; }
.btn.danger { color: var(--stop); }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-2); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 13px; border-radius: var(--r-sm);
  background: var(--fill); border: 1.5px solid transparent; color: var(--ink);
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 110px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.search {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; border-radius: var(--r-sm); background: var(--fill);
  margin-bottom: 12px;
}
.search input { flex: 1; background: none; border: 0; outline: none; }
.search svg { color: var(--ink-3); flex-shrink: 0; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; }
.switch input { appearance: none; width: 48px; height: 29px; border-radius: 999px; background: var(--line); position: relative; transition: background .18s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; inset: 3px auto 3px 3px; width: 23px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(19px); }

/* ---------- States ---------- */

.empty { text-align: center; color: var(--ink-2); padding: 56px 24px; }
.empty svg { color: var(--ink-3); margin: 0 auto 14px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }
.empty p { margin: 0; font-size: 14px; }

.skeleton { background: var(--fill); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 22px);
  transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: 90vw;
  box-shadow: var(--shadow); animation: rise .2s ease-out;
}
.toast.err { background: var(--stop); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px) } }

/* ---------- Sheet (the app's modal) ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 17, 22, .45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0 } }
.sheet {
  background: var(--bg); width: min(560px, 100%);
  border-radius: 22px 22px 0 0; max-height: 92vh; overflow-y: auto;
  animation: slide .24s cubic-bezier(.22,1,.36,1);
}
@keyframes slide { from { transform: translateY(24px) } }
.sheet-head {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 18px; }

/* ---------- Case Loop ---------- */

.case-banner {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 15px 16px; border-radius: var(--r);
  background: var(--wait-soft); border: 1px solid color-mix(in srgb, var(--wait) 32%, transparent);
  color: inherit; margin-bottom: 14px;
}
.case-banner .t { font-weight: 600; font-size: 15px; }
.case-banner .s { font-size: 13px; color: var(--ink-2); }

.confirm-card { border: 1.5px solid color-mix(in srgb, var(--wait) 38%, transparent); }
.resolution {
  background: var(--fill); border-radius: var(--r-sm);
  padding: 14px; margin: 10px 0 14px; white-space: pre-wrap;
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; font-size: 13.5px; }
.timeline .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); margin-top: 7px; flex-shrink: 0; }
.timeline .who { font-weight: 500; }
.timeline .when { color: var(--ink-3); font-size: 12px; }

/* ---------- Match card ---------- */

.pair { display: flex; align-items: center; gap: 8px; padding: 4px 0 14px; }
.pair .side { flex: 1; text-align: center; }
.pair .side .nm { font-weight: 600; font-size: 14px; margin-top: 7px; }
.pair .heart { color: var(--accent); flex-shrink: 0; }
.pair .avatar { margin: 0 auto; }

/* ---------- Grid ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { padding: 18px 12px; text-align: center; }
.tile .nm { font-weight: 600; font-size: 14px; margin: 9px 0 3px; }
.tile .mt { font-size: 12px; color: var(--ink-2); }

/* ---------- Login ---------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); text-align: center; }
.auth .mark {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 20px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font: 600 36px/1 ui-serif, Georgia, serif;
}
.auth h1 { font-size: 28px; margin-bottom: 4px; }
.auth .tag { color: var(--ink-2); margin: 0 0 28px; }
.auth form { text-align: left; }
.auth .err { color: var(--stop); font-size: 14px; margin: 0 0 12px; display: flex; gap: 7px; }
.auth .back { display: block; margin-top: 22px; font-size: 14px; color: var(--ink-2); }

/* ---------- Desktop: the tab bar becomes a rail ---------- */

@media (min-width: 880px) {
  #shell { flex-direction: row; }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 4px;
    width: 232px; flex-shrink: 0; padding: 22px 14px;
    border-right: 1px solid var(--line); background: var(--card);
    position: sticky; top: 0; height: 100dvh;
  }
  .rail .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 20px; font-weight: 700; letter-spacing: -.02em;
  }
  .rail .brand .mark {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft);
    color: var(--accent); display: grid; place-items: center;
    font: 600 17px/1 ui-serif, Georgia, serif;
  }
  .rail button {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 11px; color: var(--ink-2);
    font-size: 15px; font-weight: 500; width: 100%; text-align: left;
  }
  .rail button:hover { background: var(--fill); }
  .rail button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .rail .badge { margin-left: auto; background: var(--wait); color: #fff; }
  .rail .spacer { flex: 1; }
  .screen { padding: 34px 34px 60px; max-width: 860px; margin: 0; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; max-height: 86vh; }
  .toast { bottom: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
