/* ============================================================
   Muslimnet Community Hub — design system
   "Courtyard & Night": emerald night + brass gold (public),
   warm ivory courtyard (admin). Girih 8-point star lattice.
   ============================================================ */

/* Fonts load from a <link> in _app.tsx — an @import here would serialize
   the request chain (CSS must download before the font CSS even starts). */

:root {
  --mn-night: #0c1f18;
  --mn-night-2: #123227;
  --mn-emerald: #17604a;
  --mn-emerald-deep: #0e4534;
  --mn-brass: #c9a227;
  --mn-brass-soft: #e7cd7a;
  --mn-ivory: #f8f4e9;
  --mn-sand: #efe7d3;
  --mn-ink: #1a2b23;
  --mn-ink-soft: #4c5f55;
  --mn-line: rgba(23, 64, 48, 0.16);
  --mn-danger: #a03123;
  --mn-danger-bg: #f9e8e5;
  --mn-ok: #17604a;
  --mn-ok-bg: #e6f0e9;
  --mn-radius: 10px;
  --mn-display: "Fraunces", "Georgia", serif;
  --mn-body: "Karla", "Segoe UI", sans-serif;
  --mn-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c9a227' stroke-width='1'%3E%3Crect x='30' y='30' width='36' height='36'/%3E%3Crect x='30' y='30' width='36' height='36' transform='rotate(45 48 48)'/%3E%3Cpath d='M48 0v14M48 82v14M0 48h14M82 48h14'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- shared primitives ---------- */

.mn * { box-sizing: border-box; }
.mn {
  font-family: var(--mn-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mn h1, .mn h2, .mn h3 {
  font-family: var(--mn-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.mn-rule {
  height: 6px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--mn-brass) 0 14px,
      transparent 14px 22px,
      var(--mn-emerald) 22px 36px,
      transparent 36px 44px
    );
  opacity: 0.85;
}

.mn-btn {
  display: inline-block;
  width: 100%;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--mn-emerald-deep);
  border-radius: var(--mn-radius);
  background: linear-gradient(180deg, var(--mn-emerald), var(--mn-emerald-deep));
  color: var(--mn-ivory);
  font-family: var(--mn-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 10px rgba(12, 31, 24, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.mn-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 18px rgba(12, 31, 24, 0.3);
}
.mn-btn:active { transform: translateY(0); }
.mn-btn:focus-visible,
.mn-field input:focus-visible,
.mn-field select:focus-visible,
.mn-field textarea:focus-visible {
  outline: 2px solid var(--mn-brass);
  outline-offset: 2px;
}

.mn-field { display: block; }
.mn-field > span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--mn-ink-soft);
  margin-bottom: 0.35rem;
}
.mn-field input,
.mn-field select,
.mn-field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-family: var(--mn-body);
  font-size: 1rem;
  color: var(--mn-ink);
  background: #fff;
  border: 1px solid var(--mn-line);
  border-radius: var(--mn-radius);
  transition: border-color 0.15s ease;
}
.mn-field input:hover,
.mn-field select:hover,
.mn-field textarea:hover { border-color: var(--mn-emerald); }

.mn-check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--mn-ink);
}
.mn-check input { margin-top: 0.25rem; accent-color: var(--mn-emerald); }

.mn-flash {
  padding: 0.8rem 1rem;
  border-radius: var(--mn-radius);
  font-size: 0.95rem;
  border-left: 4px solid;
}
.mn-flash--ok { background: var(--mn-ok-bg); color: var(--mn-ok); border-color: var(--mn-ok); }
.mn-flash--err { background: var(--mn-danger-bg); color: var(--mn-danger); border-color: var(--mn-danger); }

.mn-btn--danger {
  background: linear-gradient(180deg, #b0402f, var(--mn-danger));
  border-color: var(--mn-danger);
}
.mn-btn--ghost {
  background: none;
  border: 1px solid var(--mn-line);
  color: var(--mn-ink-soft);
  box-shadow: none;
}
.mn-btn--ghost:hover { color: var(--mn-emerald-deep); border-color: var(--mn-emerald); }

.mn-row-link { text-decoration: none; color: inherit; display: block; }
.mn-table a.mn-strong {
  text-decoration: underline;
  text-decoration-color: var(--mn-brass);
  text-underline-offset: 3px;
}
.mn-table a.mn-strong:hover { color: var(--mn-emerald); }

.mn-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.mn-actions .mn-btn { width: auto; flex: 1 1 auto; }

/* ---------- helper chatbot ---------- */
.mn-chat { display: grid; gap: 0.8rem; }
.mn-chat-log { display: grid; gap: 0.6rem; max-height: 22rem; overflow-y: auto; }
.mn-chat-msg {
  padding: 0.7rem 0.9rem;
  border-radius: var(--mn-radius);
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.mn-chat-msg--q {
  background: var(--mn-sand);
  border: 1px solid var(--mn-line);
  justify-self: end;
  max-width: 85%;
}
.mn-chat-msg--a {
  background: #fffdf7;
  border: 1px solid var(--mn-line);
  border-left: 3px solid var(--mn-brass);
  max-width: 95%;
}
.mn-chat form { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.mn-chat input {
  flex: 1 1 16rem;
  padding: 0.65rem 0.8rem;
  font-family: var(--mn-body);
  font-size: 1rem;
  border: 1px solid var(--mn-line);
  border-radius: var(--mn-radius);
}
.mn-chat .mn-btn { width: auto; }

/* ---------- night surface (public + login) ---------- */

.mn-night {
  min-height: 100vh;
  background:
    var(--mn-star) center / 96px 96px,
    radial-gradient(1100px 500px at 70% -10%, rgba(201, 162, 39, 0.13), transparent 60%),
    linear-gradient(170deg, var(--mn-night) 20%, var(--mn-night-2) 100%);
  background-blend-mode: soft-light, normal, normal;
  color: var(--mn-ivory);
}

.mn-night ::selection { background: var(--mn-brass); color: var(--mn-night); }

.mn-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mn-brass-soft);
}
.mn-kicker::before { content: "✦ "; }

.mn-night h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  color: var(--mn-ivory);
}
.mn-night .mn-lede { color: rgba(248, 244, 233, 0.72); font-size: 1.08rem; max-width: 46ch; }

/* ---------- courtyard surface (admin) ---------- */

.mn-day {
  min-height: 100vh;
  background:
    var(--mn-star) center / 96px 96px,
    linear-gradient(180deg, var(--mn-ivory), var(--mn-sand));
  background-blend-mode: overlay, normal;
  color: var(--mn-ink);
}
.mn-day-inner { max-width: 60rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.mn-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.mn-topbar h1 { font-size: 1.9rem; color: var(--mn-emerald-deep); }
.mn-topbar a, .mn-linkbtn {
  font-size: 0.9rem;
  color: var(--mn-ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--mn-body);
  text-decoration: underline;
  text-decoration-color: var(--mn-brass);
  text-underline-offset: 3px;
}
.mn-topbar a:hover, .mn-linkbtn:hover { color: var(--mn-emerald-deep); }

.mn-card {
  background: #fffdf7;
  border: 1px solid var(--mn-line);
  border-top: 3px solid var(--mn-brass);
  border-radius: var(--mn-radius);
  box-shadow: 0 1px 2px rgba(26, 43, 35, 0.05), 0 10px 30px -18px rgba(26, 43, 35, 0.25);
  padding: 1.5rem;
}
.mn-card h2 {
  font-size: 1.25rem;
  color: var(--mn-emerald-deep);
  margin-bottom: 1rem;
}

.mn-stat {
  display: block;
  text-decoration: none;
  background: #fffdf7;
  border: 1px solid var(--mn-line);
  border-radius: var(--mn-radius);
  padding: 1.4rem 1.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}
.mn-stat::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--mn-brass);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s ease;
}
.mn-stat:hover {
  transform: translateY(-2px);
  border-color: var(--mn-emerald);
  box-shadow: 0 12px 28px -16px rgba(26, 43, 35, 0.35);
}
.mn-stat:hover::after { transform: scaleY(1); }
.mn-stat b {
  display: block;
  font-family: var(--mn-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--mn-emerald-deep);
  line-height: 1.1;
}
.mn-stat span { color: var(--mn-ink-soft); font-size: 0.95rem; }

.mn-grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.mn-form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.mn-span-2 { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .mn-grid-2 { grid-template-columns: 1fr 1fr; }
  .mn-form-grid { grid-template-columns: 1fr 1fr; }
}

.mn-tablewrap {
  background: #fffdf7;
  border: 1px solid var(--mn-line);
  border-radius: var(--mn-radius);
  overflow-x: auto;
}
.mn-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.mn-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mn-ink-soft);
  padding: 0.8rem 1rem;
  border-bottom: 2px solid var(--mn-brass);
  white-space: nowrap;
}
.mn-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--mn-line);
  vertical-align: top;
}
.mn-table tr:last-child td { border-bottom: none; }
.mn-table tr:hover td { background: rgba(201, 162, 39, 0.06); }
.mn-table .mn-strong { font-weight: 700; color: var(--mn-emerald-deep); }
.mn-table .mn-dim { color: var(--mn-ink-soft); }

.mn-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}
.mn-badge--pub { color: var(--mn-emerald-deep); border-color: var(--mn-emerald); background: var(--mn-ok-bg); }
.mn-badge--priv { color: var(--mn-ink-soft); border-color: var(--mn-line); background: var(--mn-sand); }

/* ---------- login ---------- */

.mn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.mn-login-card {
  width: 100%;
  max-width: 25rem;
  background: rgba(248, 244, 233, 0.98);
  border-radius: var(--mn-radius);
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
  animation: mn-rise 0.5s ease both;
}
.mn-login-card > div:not(.mn-rule),
.mn-login-card form > div {
  padding: 2.2rem 2rem;
  display: grid;
  gap: 1.1rem;
}
.mn-login-card h1 {
  font-size: 1.7rem;
  color: var(--mn-emerald-deep);
  margin: 0.1rem 0 0.2rem;
}
.mn-login-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--mn-ink-soft);
}
.mn-login-card .mn-kicker { color: var(--mn-brass); }
.mn-login-card .mn-field { margin-top: 0.4rem; }
.mn-login-card .mn-btn { margin-top: 0.3rem; }

/* ---------- public events ---------- */

.mn-events-wrap { max-width: 44rem; margin: 0 auto; padding: 3.5rem 1.25rem 5rem; }
.mn-events-head { display: grid; gap: 0.8rem; margin-bottom: 2.2rem; }

.mn-subscribe {
  background: rgba(248, 244, 233, 0.06);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: var(--mn-radius);
  padding: 1.2rem;
  margin-bottom: 2.5rem;
  backdrop-filter: blur(4px);
}
.mn-subscribe form { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.mn-subscribe input {
  flex: 1 1 14rem;
  padding: 0.7rem 0.9rem;
  font-family: var(--mn-body);
  font-size: 1rem;
  border-radius: var(--mn-radius);
  border: 1px solid transparent;
  background: var(--mn-ivory);
  color: var(--mn-ink);
}
.mn-subscribe .mn-btn { width: auto; flex: 0 0 auto; }

/* Night surfaces: brass buttons — emerald-on-emerald has no contrast there */
.mn-night .mn-btn {
  background: linear-gradient(180deg, var(--mn-brass-soft), var(--mn-brass));
  border-color: var(--mn-brass);
  color: var(--mn-night);
  text-shadow: none;
}
.mn-night .mn-btn:hover { filter: brightness(1.05); }
.mn-subscribe .mn-ok-note { color: var(--mn-brass-soft); font-size: 1rem; margin: 0; }

.mn-event {
  position: relative;
  background: rgba(248, 244, 233, 0.04);
  border: 1px solid rgba(248, 244, 233, 0.12);
  border-left: 3px solid var(--mn-brass);
  border-radius: var(--mn-radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  animation: mn-rise 0.55s ease both;
}
.mn-event:nth-child(1) { animation-delay: 0.05s; }
.mn-event:nth-child(2) { animation-delay: 0.12s; }
.mn-event:nth-child(3) { animation-delay: 0.19s; }
.mn-event:nth-child(4) { animation-delay: 0.26s; }
.mn-event:nth-child(5) { animation-delay: 0.33s; }
.mn-event:hover {
  background: rgba(248, 244, 233, 0.08);
  border-left-color: var(--mn-brass-soft);
  transform: translateX(4px);
}
.mn-event time {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mn-brass-soft);
  margin-bottom: 0.3rem;
}
.mn-event h2 { font-size: 1.35rem; color: var(--mn-ivory); }
.mn-event .mn-where { font-size: 0.9rem; color: rgba(248, 244, 233, 0.6); margin-top: 0.15rem; }
.mn-event .mn-desc { font-size: 0.95rem; color: rgba(248, 244, 233, 0.78); margin: 0.6rem 0 0; }

.mn-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: rgba(248, 244, 233, 0.55);
  font-style: italic;
}

/* ---------- public article page ---------- */
.mn-article {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
  color: var(--mn-ink);
}
.mn-article h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  color: var(--mn-emerald-deep);
  margin: 0.4rem 0 1.4rem;
}
.mn-tldr {
  background: var(--mn-ok-bg);
  border-left: 4px solid var(--mn-brass);
  border-radius: var(--mn-radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.6rem;
}
.mn-tldr b {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--mn-emerald-deep);
  margin-bottom: 0.3rem;
}
.mn-tldr p { margin: 0; color: var(--mn-ink); line-height: 1.6; }
.mn-video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-bottom: 1.6rem;
  border-radius: var(--mn-radius);
  overflow: hidden;
  background: var(--mn-night);
}
.mn-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.mn-prose { line-height: 1.75; font-size: 1.05rem; }
.mn-prose h2, .mn-prose h3 {
  font-family: var(--mn-display);
  color: var(--mn-emerald-deep);
  margin: 1.8rem 0 0.6rem;
}
.mn-prose p { margin: 0 0 1rem; }
.mn-prose a { color: var(--mn-emerald); text-decoration-color: var(--mn-brass); }
.mn-prose blockquote {
  border-left: 3px solid var(--mn-brass);
  margin: 1rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  color: var(--mn-ink-soft);
  font-style: italic;
}
.mn-prose ul, .mn-prose ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.mn-prose img { max-width: 100%; border-radius: 8px; }
.mn-prose code {
  background: var(--mn-sand);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

@keyframes mn-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .mn *, .mn *::before, .mn *::after { animation: none !important; transition: none !important; }
}

/* ---------- tabs (radio-driven, no JS) ---------- */
.mn-tabs { position: relative; }
.mn-tabs > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mn-tabbar {
  display: flex;
  gap: 0.35rem;
  border-bottom: 2px solid var(--mn-line);
  margin-bottom: 1.2rem;
}

.mn-tabbar label {
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--mn-ink-soft);
  border-radius: 8px 8px 0 0;
  border: 2px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color 0.15s ease, background 0.15s ease;
}

.mn-tabbar label:hover { color: var(--mn-emerald); }

.mn-tabs > .mn-tabpanel { display: none; }

.mn-tabs > input:nth-of-type(1):checked ~ .mn-tabpanel:nth-of-type(1),
.mn-tabs > input:nth-of-type(2):checked ~ .mn-tabpanel:nth-of-type(2) {
  display: block;
}

.mn-tabs > input:nth-of-type(1):checked ~ .mn-tabbar label:nth-of-type(1),
.mn-tabs > input:nth-of-type(2):checked ~ .mn-tabbar label:nth-of-type(2) {
  color: var(--mn-emerald-deep);
  background: rgba(201, 162, 39, 0.12);
  border-color: var(--mn-line);
  border-bottom: 2px solid var(--mn-ivory, #f8f4e9);
}

/* ---------- floating assistant (admin) ---------- */
.mn-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(160deg, var(--mn-brass), #b08d1e);
  color: var(--mn-night);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(12, 31, 24, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mn-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(12, 31, 24, 0.4);
}

.mn-chatbox {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 900;
  width: min(370px, calc(100vw - 36px));
  max-height: min(560px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: #fffdf6;
  border: 1px solid var(--mn-line);
  border-top: 3px solid var(--mn-brass);
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(12, 31, 24, 0.35);
  padding: 0.9rem 1rem 1rem;
  overflow: hidden;
}

.mn-chatbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mn-display);
  font-size: 1.05rem;
  color: var(--mn-emerald-deep);
  margin-bottom: 0.2rem;
}

.mn-chatbox-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--mn-ink-soft);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}

.mn-chatbox-close:hover {
  background: rgba(201, 162, 39, 0.15);
  color: var(--mn-emerald-deep);
}

.mn-chatbox-hint {
  font-size: 0.82rem;
  color: var(--mn-ink-soft);
  margin: 0 0 0.6rem;
}

.mn-chatbox .mn-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mn-chatbox .mn-chat-log {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

/* ---------- event add-to-calendar links ---------- */
.mn-event-actions {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
  font-size: 0.85rem;
}

.mn-event-actions a {
  color: var(--mn-brass-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(231, 205, 122, 0.35);
  padding-bottom: 1px;
}

.mn-event-actions a:hover {
  color: #fff;
  border-bottom-color: var(--mn-brass);
}

/* ---------- events filter bar ---------- */
.mn-filter {
  margin: 0 0 1.6rem;
}

.mn-filter form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: flex-end;
  background: rgba(248, 244, 233, 0.05);
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.mn-filter label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mn-brass-soft);
}

.mn-filter input {
  background: rgba(12, 31, 24, 0.6);
  border: 1px solid rgba(248, 244, 233, 0.25);
  border-radius: 8px;
  color: var(--mn-ivory);
  padding: 0.5rem 0.65rem;
  font-family: var(--mn-body);
  font-size: 0.92rem;
  min-height: 42px;
}

.mn-filter input::placeholder { color: rgba(248, 244, 233, 0.4); }

.mn-filter input:focus {
  outline: none;
  border-color: var(--mn-brass);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.25);
}

.mn-filter input[type="date"] { color-scheme: dark; }

.mn-filter-near { flex: 1; min-width: 180px; }

.mn-filter .mn-btn { min-height: 42px; }

.mn-filter-clear {
  color: rgba(248, 244, 233, 0.6);
  font-size: 0.85rem;
  align-self: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mn-filter-clear:hover { color: var(--mn-brass-soft); }

/* ---------- events view toggle + cards + distance ---------- */
.mn-viewtoggle {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 1.2rem;
}

.mn-viewtoggle a {
  padding: 0.4rem 1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 999px;
  color: rgba(248, 244, 233, 0.7);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
}

.mn-viewtoggle a.is-active {
  background: var(--mn-brass);
  border-color: var(--mn-brass);
  color: var(--mn-night);
}

.mn-viewtoggle a:not(.is-active):hover { color: var(--mn-brass-soft); }

.mn-events-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .mn-events-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 980px) {
  .mn-events-grid { grid-template-columns: repeat(3, 1fr); }
}

.mn-events-grid .mn-event {
  background: rgba(248, 244, 233, 0.05);
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mn-events-grid .mn-event .mn-event-actions { margin-top: auto; padding-top: 0.7rem; }

.mn-miles {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.18);
  color: var(--mn-brass-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.mn-filter-note {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: rgba(248, 244, 233, 0.65);
}

/* ---------- API docs page ---------- */
.mn-api-doc { color: rgba(248, 244, 233, 0.85); }
.mn-api-doc h2 {
  color: var(--mn-brass-soft);
  margin: 2rem 0 0.6rem;
  font-size: 1.3rem;
}
.mn-api-doc h3 {
  color: var(--mn-ivory);
  margin: 1.2rem 0 0.4rem;
  font-size: 1.05rem;
}
.mn-api-doc p, .mn-api-doc li { line-height: 1.6; }
.mn-api-doc ul { padding-left: 1.2rem; margin: 0.4rem 0 1rem; }
.mn-api-doc a { color: var(--mn-brass-soft); }
.mn-api-doc code {
  background: rgba(201, 162, 39, 0.15);
  color: var(--mn-brass-soft);
  padding: 0.08em 0.4em;
  border-radius: 5px;
  font-size: 0.9em;
}
.mn-code {
  display: block;
  background: rgba(12, 31, 24, 0.75);
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--mn-ivory);
  white-space: pre;
  margin: 0.6rem 0 1.2rem;
}

/* ---------- events: calendar view ---------- */
.mn-cal {
  margin-bottom: 1.6rem;
}
.mn-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.mn-cal-nav h2 {
  font-family: var(--mn-serif, Georgia, serif);
  font-size: 1.15rem;
  color: var(--mn-ivory);
  margin: 0;
}
.mn-cal-nav a {
  color: var(--mn-brass-soft);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 8px;
}
.mn-cal-nav a:hover {
  background: rgba(201, 162, 39, 0.15);
}
.mn-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.mn-cal-head {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mn-brass-soft);
  padding: 0.35rem 0;
}
.mn-cal-cell {
  min-height: 4.6rem;
  background: rgba(12, 31, 24, 0.6);
  border: 1px solid rgba(201, 162, 39, 0.14);
  border-radius: 8px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mn-cal-cell.is-blank {
  background: transparent;
  border-color: transparent;
}
.mn-cal-cell.is-today {
  border-color: var(--mn-brass-soft, #c9a227);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45) inset;
}
.mn-cal-day {
  font-size: 0.72rem;
  color: rgba(248, 244, 233, 0.55);
}
.mn-cal-cell.is-today .mn-cal-day {
  color: var(--mn-brass-soft);
  font-weight: 700;
}
.mn-cal-chip {
  display: block;
  background: rgba(23, 96, 74, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--mn-ivory);
  text-decoration: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mn-cal-chip:hover {
  background: rgba(23, 96, 74, 0.85);
}
.mn-cal-chip-time {
  color: var(--mn-brass-soft);
  font-weight: 700;
}
@media (max-width: 640px) {
  .mn-cal-cell {
    min-height: 3.4rem;
    padding: 0.2rem;
  }
  .mn-cal-chip {
    font-size: 0.6rem;
    padding: 0.12rem 0.25rem;
  }
}

/* ---------- events: signed-in extras ---------- */
.mn-digest-toggle p {
  margin: 0 0 0.7rem;
  color: var(--mn-ivory);
}
.mn-save-form {
  display: inline;
}
.mn-save-btn {
  background: none;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 8px;
  color: var(--mn-brass-soft);
  font-size: 0.82rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.mn-save-btn:hover {
  background: rgba(201, 162, 39, 0.15);
}
.mn-save-btn.is-saved {
  background: rgba(201, 162, 39, 0.18);
  font-weight: 700;
}
.mn-saved-note {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--mn-brass-soft);
}
