/* AUNOR Web · theme. Loaded last, over premium.css and premium-groups.css.

   A calm control room. Most of the time everyone is fine, and when they are
   not it must be obvious at once, so:
   - red means an emergency (a live alert, an SOS, deleting) and nothing else;
     everyday primary actions are the brand's night petrol;
   - one family, Poppins (the app's), in sentence case: no monospace labels,
     no all-caps eyebrows;
   - a cool mist ground and white surfaces, separated by hairlines rather
     than shadows;
   - the one loud element is the status beacon at the top of the sidebar. */

:root {
  --night: #13242c;
  --night-2: #1b313b;
  --night-3: #264350;
  --night-text: #c5d3d8;
  --night-muted: #8aa0a8;
  --ink: #16262d;
  --muted: #56676e;
  --quiet: #7a8a90;
  --mist: #eef2f3;
  --paper: #ffffff;
  --hairline: #dbe2e5;
  --hairline-strong: #c4cfd3;
  --alarm: #d9362c;
  --alarm-strong: #b8291f;
  --alarm-soft: #fdecea;
  --ok: #2f8f6e;
  --ok-soft: #e4f3ed;
  --focus: rgba(31, 111, 139, 0.38);

  /* premium.css' own tokens, pointed at the new palette */
  --navy-950: var(--night);
  --navy-900: var(--ink);
  --navy-800: var(--night-3);
  --blue-600: var(--night);
  --blue-700: #0b1a20;
  --blue-050: #e6edf0;
  --signal: var(--alarm);
  --signal-dark: var(--alarm-strong);
  --signal-soft: var(--alarm-soft);
  --success: var(--ok);
  --success-soft: var(--ok-soft);
  --line: var(--hairline);
  --line-strong: var(--hairline-strong);
  --ground: var(--mist);
  --ground-deep: #e1e8ea;
  --display: "Aunor Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Aunor Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --utility: "Aunor Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 2px rgba(19, 36, 44, 0.05);
  --shadow-md: 0 24px 60px rgba(19, 36, 44, 0.22);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
}

html, body { background: var(--mist); }
body { color: var(--ink); font: 400 14px/1.55 var(--body); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { color: #fff; background: var(--night); }

/* One case for everything: sentence case, normal tracking. Acronyms that
   must stay upper case are written that way in the text. */
.portal *, .dialog *, .auth-page * { letter-spacing: normal; }
.portal *:not(.keep-case), .dialog *:not(.keep-case), .auth-page *:not(.keep-case) { text-transform: none !important; }
.eyebrow:not(.keep-case) { text-transform: lowercase !important; }
.eyebrow:not(.keep-case)::first-letter { text-transform: uppercase; }

/* ------------------------------------------------------------ shell ----- */
.portal { grid-template-columns: 264px minmax(0, 1fr); background: var(--mist); }

.sidebar {
  gap: 0;
  padding: 18px 14px 14px;
  color: var(--night-text);
  background: var(--night);
  border-right: 1px solid #0c1a20;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.sidebar .brand { gap: 10px; padding: 0; }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar .brand strong { display: block; color: #fff; font: 700 16px/1.1 var(--display); letter-spacing: 0.01em; }
.sidebar .brand small { display: block; color: var(--night-muted); font: 500 12px/1.3 var(--body); }
.sidebar-close { display: none; }

/* The beacon: green and quiet while all is well, red and pulsing when an
   alert is live, naming who and where. It opens the alerts. */
.status-beacon {
  width: 100%;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.status-beacon:hover { background: rgba(255, 255, 255, 0.07); }
.beacon-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--night-muted); box-shadow: 0 0 0 4px rgba(138, 160, 168, 0.18); }
.beacon-copy { min-width: 0; display: grid; gap: 1px; }
.beacon-copy strong { font: 600 14px/1.3 var(--body); }
.beacon-copy small { overflow: hidden; color: var(--night-muted); font: 400 12px/1.35 var(--body); text-overflow: ellipsis; white-space: nowrap; }
.status-beacon[data-state="calm"] .beacon-dot { background: #4cc79a; box-shadow: 0 0 0 4px rgba(76, 199, 154, 0.2); }
.status-beacon[data-state="alarm"] { border-color: rgba(255, 110, 96, 0.55); background: rgba(217, 54, 44, 0.24); }
.status-beacon[data-state="alarm"] .beacon-dot { background: #ff5a4e; animation: beacon-pulse 1.6s ease-out infinite; }
.status-beacon[data-state="alarm"] small { color: #ffd2cd; }
@keyframes beacon-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 78, 0.55); } 100% { box-shadow: 0 0 0 12px rgba(255, 90, 78, 0); } }

.sidebar nav { display: grid; gap: 2px; align-content: start; }
.sidebar .nav-link,
.sidebar .nav-link-badged {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--night-text);
  background: transparent;
  text-align: left;
  font: 500 14px/1.2 var(--body);
}
.sidebar .nav-link::before, .sidebar .nav-link::after { content: none !important; display: none !important; }
.sidebar .nav-link .nav-icon { color: var(--night-muted); transition: color 150ms ease; }
.sidebar .nav-link:hover:not(:disabled) { color: #fff; background: var(--night-2); }
.sidebar .nav-link:hover .nav-icon { color: #fff; }
.sidebar .nav-link.active { color: #fff; background: var(--night-3); font-weight: 600; }
.sidebar .nav-link.active .nav-icon { color: #9fe0c7; }
.sidebar .nav-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; color: #fff; background: var(--alarm); box-shadow: none; font: 700 11px/22px var(--body); text-align: center; }
.nav-section { margin: 18px 12px 6px; color: var(--night-muted); font: 500 12px/1.2 var(--body); }

.sidebar-account {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-account .avatar { width: 36px; height: 36px; color: var(--night); background: #9fe0c7; font: 700 14px/1 var(--display); }
.account-copy { min-width: 0; display: grid; }
.account-copy strong { overflow: hidden; color: #fff; font: 600 13px/1.3 var(--body); text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { overflow: hidden; color: var(--night-muted); font: 400 12px/1.35 var(--body); text-overflow: ellipsis; white-space: nowrap; }
.account-logout { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; color: var(--night-muted); background: transparent; }
.account-logout:hover { color: #fff; background: var(--night-2); }
.sidebar .account-card, .sidebar-bottom { display: none !important; }

.portal-main { width: min(1280px, 100%); padding: 0 clamp(20px, 3.4vw, 48px) 72px; }
.portal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 calc(-1 * clamp(20px, 3.4vw, 48px)) 28px;
  padding: 14px clamp(20px, 3.4vw, 48px);
  border-bottom: 1px solid var(--hairline);
  background: rgba(238, 242, 243, 0.92);
  backdrop-filter: saturate(1.2) blur(10px);
}
.portal-title { min-width: 0; flex: 1; }
.portal-header h1 { margin: 0; font: 700 24px/1.2 var(--display); letter-spacing: -0.015em; }
.portal-header .page-summary, .portal-header #pageKicker { display: none; }
.menu-toggle { display: none; width: 42px; height: 42px; place-items: center; padding: 0; border: 1px solid var(--hairline); border-radius: 10px; color: var(--ink); background: var(--paper); }
.portal-locale select { min-width: 132px; min-height: 38px; padding: 7px 34px 7px 12px; border-radius: 10px; font: 500 13px/1.2 var(--body); }
.sidebar-scrim { position: fixed; z-index: 60; inset: 0; background: rgba(8, 18, 23, 0.5); }
/* Leaflet panes carry z-index 400-1000: keep them inside the map so the menu and dialogs stay on top. */
.leaflet-container { z-index: 0; }

/* ----------------------------------------------------- page structure --- */
.portal-page { min-height: 0; }
.section-heading { align-items: flex-end; margin-bottom: 20px; }
.section-heading .eyebrow { display: none; }
.section-heading h2, .section-copy h2 { margin: 0 0 4px; font: 700 20px/1.3 var(--display); letter-spacing: -0.01em; }
.section-copy p { max-width: 70ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font: 600 12px/1.3 var(--body); }

/* The selected group, as a quiet line rather than a dark strip. */
.active-group-context {
  min-height: 56px;
  margin: 0 0 24px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--group-accent);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
}
.context-pulse { width: 34px; height: 34px; border: 0; background: color-mix(in srgb, var(--group-accent) 12%, var(--paper)); }
.context-copy small { color: var(--muted); font: 500 12px/1.3 var(--body); }
.context-copy strong { font: 600 15px/1.3 var(--body); }
.context-meta span { padding: 5px 10px; border: 1px solid var(--hairline); border-radius: 999px; color: var(--muted); background: var(--mist); font: 500 12px/1 var(--body); }

/* ----------------------------------------------------------- controls --- */
.button {
  min-height: 40px;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font: 600 13px/1.2 var(--body);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.button:hover:not(:disabled) { transform: none; }
.button-small { min-height: 34px; padding: 7px 12px; font-size: 12.5px; }
.button-primary { color: #fff; background: var(--night); box-shadow: none; }
.button-primary:hover:not(:disabled) { background: #0b1a20; box-shadow: none; }
.button-secondary { color: var(--ink); border-color: var(--hairline-strong); background: var(--paper); }
.button-secondary:hover:not(:disabled) { border-color: #9fb0b6; background: var(--tint-f6f8f9, #f6f8f9); }
.button-danger { color: #fff; background: var(--alarm); }
.button-danger:hover:not(:disabled) { background: var(--alarm-strong); }
.danger-outline { border-color: rgba(217, 54, 44, 0.45) !important; color: var(--alarm-strong) !important; }
.danger-outline:hover:not(:disabled) { background: var(--alarm-soft) !important; }
.text-button { min-height: 34px; padding: 6px 8px; border-radius: 8px; color: var(--muted); font: 600 12.5px/1.2 var(--body); }
.text-button:hover { color: var(--ink); background: rgba(19, 36, 44, 0.05); }
.danger-text { color: var(--alarm-strong) !important; }
.icon-button { width: 36px; height: 36px; border-color: var(--hairline); color: var(--muted); }

label, legend { margin: 16px 0 6px; color: var(--ink); font: 600 13px/1.3 var(--body); }
input, select, textarea {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font: 400 14px/1.4 var(--body);
}
input:hover, select:hover, textarea:hover { border-color: #9fb0b6; }
input:focus, select:focus, textarea:focus { border-color: #1f6f8b; box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.16); }
input::placeholder, textarea::placeholder { color: #8d9ca2; }
.field-help, .hint, .tiny, .format-description, .form-intro { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.form-message { font-size: 12.5px; }
.check-option { border-radius: 10px; font-size: 13px !important; }

/* Tabs: an underline, not a grey pill tray. */
.transport-tabs {
  gap: 4px;
  margin-bottom: 20px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.transport-tab {
  position: relative;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font: 500 14px/1.2 var(--body);
}
.transport-tab:hover { color: var(--ink); }
.transport-tab.active { color: var(--ink); background: transparent; box-shadow: none; font-weight: 600; }
.transport-tab.active::after { content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px; height: 3px; border-radius: 3px 3px 0 0; background: var(--night); }
.alerts-tabs, .family-tabs, .pets-tabs { max-width: none; }
.mini-tabs button { font-size: 13px; }

/* Pills and small labels: readable size, sentence case. */
.type-pill, .status-pill {
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font: 600 12px/1.3 var(--body);
}
.alert-status { padding: 4px 9px; border-radius: 999px; font: 600 11.5px/1.2 var(--body); }
.alert-status.live { background: var(--alarm); }
.metric { border-radius: 10px; }
.metric strong { color: var(--ink); }
.metric small { font: 500 12px/1.2 var(--body); }
.family-badge { font-size: 11.5px; }

/* --------------------------------------------------------- surfaces ----- */
.group-grid { gap: 12px; }
.group-card { border-radius: var(--radius-lg); border-color: var(--hairline); }
.group-card::before { display: none; }
.group-card:hover { transform: none; border-color: var(--hairline-strong); box-shadow: var(--shadow-sm); }
.group-card.selected { border-color: var(--night); background: var(--paper); box-shadow: 0 0 0 1px var(--night); }
.group-card > button { padding: 16px 18px; }
.group-card h3 { font: 700 16px/1.3 var(--display); letter-spacing: -0.01em; }
.group-card-description { font-size: 12.5px; }
.group-card-footer { border-left-color: var(--hairline); font: 500 12px/1.3 var(--body); }
.group-open-arrow { display: none; }
.selected-mark { color: var(--night); font: 600 12px/1 var(--body); }

.group-detail-card, .family-card, .alert-detail, .chat-layout, .med-card, .home-card, .handover-card, .pet-card, .agenda-day, .alerts-stat, .alert-row, .care-row, .help-item, .alerts-calm, .pets-question {
  border-color: var(--hairline);
}
.group-detail-card, .family-card, .alert-detail, .chat-layout, .med-card, .pet-card { border-radius: var(--radius-lg); box-shadow: none; }
.family-card h3 { font: 700 16px/1.3 var(--display); }
.alerts-stat strong { color: var(--ink); }

.empty-state {
  min-height: 140px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.empty-state::before {
  content: "";
  width: 40px;
  height: 40px;
  justify-self: center;
  margin-bottom: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--mist) no-repeat center / 20px 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356676e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2 2 7l10 5 10-5-10-5Z'/%3E%3Cpath d='m2 17 10 5 10-5'/%3E%3Cpath d='m2 12 10 5 10-5'/%3E%3C/svg%3E");
}
.empty-state strong { font-size: 15px; }
.empty-state span { font-size: 13px; }

/* ----------------------------------------------------------- dialogs ---- */
.dialog { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.dialog::backdrop { background: rgba(8, 18, 23, 0.55); backdrop-filter: blur(2px); }
.dialog form, .dialog-form { padding: 24px; }
.dialog-heading { margin: -24px -24px 20px; padding: 20px 24px 16px; border-top: 0; border-bottom: 1px solid var(--hairline); background: var(--paper); }
.dialog-heading h2, .confirm-dialog h2 { font: 700 20px/1.25 var(--display); letter-spacing: -0.01em; }
.dialog-heading .eyebrow { margin-bottom: 4px; }
.dialog-actions { gap: 8px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.confirm-symbol { color: var(--alarm); background: var(--alarm-soft); }

.toast {
  right: 24px;
  bottom: 24px;
  padding: 12px 16px 12px 40px;
  border-left: 0;
  border-radius: 12px;
  background: var(--night);
  box-shadow: var(--shadow-md);
  font: 500 13px/1.4 var(--body);
}

/* ------------------------------------------------------------- login ---- */
/* Night panel with what the web is for, mist side with a plain card. No red: nothing is wrong here. */
.auth-page { background: var(--mist); }
.auth-page::before {
  inset: 0 43% 0 0;
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(84, 212, 165, 0.10), transparent 60%),
    linear-gradient(160deg, var(--night) 0%, #10202a 100%);
  background-size: auto;
}
.auth-page::after { display: none; }
.auth-copy { padding-top: 120px; }
.auth-copy .eyebrow { color: #9fd9c4; font: 600 13px/1.3 var(--body); }
.auth-copy .eyebrow { text-transform: none !important; }
.auth-copy h1 { max-width: 560px; font: 700 clamp(36px, 4.2vw, 56px)/1.08 var(--display); letter-spacing: -0.03em; }
.auth-copy .lede { max-width: 500px; margin-top: 20px; color: #b9c9cf; font-size: 16px; line-height: 1.65; }
.feature-list { max-width: 500px; grid-template-columns: 1fr; gap: 6px; margin-top: 36px; border: 0; }
.feature-list > div {
  min-height: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border: 0;
}
.feature-list > div:first-child { padding-left: 0; }
.feature-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #9fd9c4;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.feature-list p { display: grid; gap: 2px; margin: 0; }
.feature-list small { color: #fff; font: 600 14px/1.3 var(--body); letter-spacing: normal; }
.feature-list span:not(.feature-icon) { color: #9fb4bd; font-size: 13px; font-weight: 400; line-height: 1.45; }
.auth-status { margin-top: 28px; color: #9fb4bd; font: 500 12px/1.4 var(--body); }

.auth-card {
  width: min(420px, calc(100% - 56px));
  padding: 32px;
  border: 1px solid var(--hairline);
  border-top: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(19, 36, 44, 0.04), 0 18px 40px -18px rgba(19, 36, 44, 0.18);
}
.auth-locale { padding-bottom: 16px; margin-bottom: 20px; border-bottom-color: var(--hairline); }
.auth-locale label { font: 500 13px/1.2 var(--body); letter-spacing: normal; }
.auth-card-header { grid-template-columns: 1fr; padding-bottom: 20px; margin-bottom: 20px; border-bottom-color: var(--hairline); }
.auth-card-header .eyebrow { color: var(--muted); }
.auth-card h2 { font: 700 24px/1.2 var(--display); letter-spacing: -0.02em; }
.auth-card-header p:last-child { font-size: 14px; }
.auth-steps::before { background: var(--hairline); }
.auth-steps li > span { border-color: var(--hairline-strong); color: var(--night); background: var(--mist); font: 600 12px/1 var(--body); }
.auth-steps strong { max-width: 100px; color: var(--muted); font-size: 12px; font-weight: 500; }
.auth-card > .button-primary, .code-block > .button-primary { width: 100%; min-height: 46px; background: var(--night); }
.session-note { border-radius: var(--radius); }

/* ------------------------------------------------------------ mobile ---- */
@media (max-width: 1040px) {
  body { padding-bottom: 0; }
  .portal { display: block; }
  .menu-toggle { display: inline-grid; }
  .sidebar {
    position: fixed;
    z-index: 70;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 16px 14px 14px;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: none;
  }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 24px 0 60px rgba(8, 18, 23, 0.35); }
  .sidebar-close { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 0; border-radius: 9px; color: var(--night-text); background: transparent; }
  .sidebar .brand small { display: block !important; }
  .sidebar nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: row !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
  }
  .sidebar .nav-link, .sidebar .nav-link-badged {
    min-height: 46px;
    grid-template-columns: 20px minmax(0, 1fr) auto !important;
    justify-items: start !important;
    padding: 10px 12px !important;
    text-align: left !important;
    font-size: 15px !important;
  }
  .sidebar .nav-link-badged .nav-badge { position: static !important; }
  .sidebar-account { display: grid !important; }
  .portal-main { padding: 0 18px 48px; }
  .portal-header { flex-direction: row !important; align-items: center !important; margin: 0 -18px 20px; padding: 12px 18px; min-height: 64px; }
  .portal-header .header-actions { width: auto; margin: 0 0 0 auto; }
  .portal-header h1 { font-size: 20px; }
  .portal-locale select { min-width: 0; width: auto; }
  .portal-header h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 1040px) {
  .auth-page::before { right: 42%; }
}
@media (max-width: 800px) {
  .auth-page { background: var(--night); }
  .auth-page::before { inset: 0; height: auto; }
  .auth-copy { padding: 24px 4px 28px; }
  /* On a phone the form matters more than the tour: it shows right after the headline. */
  .auth-copy .feature-list { display: none; }
  .auth-copy h1 { font-size: clamp(32px, 9vw, 44px); }
  .auth-card { width: 100%; padding: 24px 20px; }
}
@media (max-width: 560px) {
  .portal-header { gap: 10px; }
  .portal-locale select { padding-left: 10px; padding-right: 28px; }
  .section-heading h2 { font-size: 18px; }
  .dialog form, .dialog-form { padding: 18px; }
  .dialog-heading { margin: -18px -18px 16px; padding: 16px 18px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .status-beacon[data-state="alarm"] .beacon-dot { animation: none; }
  .sidebar { transition: none; }
}

/* Red is for what is live. A closed alert is history: neutral. */
.alert-row:not(.is-live) { --tone: #6b7c82; --tone-soft: var(--mist); }
.alert-row.is-selected:not(.is-live) { border-color: var(--night); box-shadow: 0 0 0 1px var(--night); }
.alert-sheet-head.is-closed { --tone: #6b7c82; }
.alert-status.closed { color: var(--ok); background: var(--ok-soft); }

/* A help or pickup request is not an alarm: "open" reads calm, not red. */
.help-item .alert-status.live { color: var(--calm, var(--ink-1f6f8b, #1f6f8b)); background: var(--calm-soft, var(--tint-e7f2f6, #e7f2f6)); }

/* ------------------------------------------------- sidebar, second pass ---- */
/* The selected view is a light pill on the dark rail: readable at a glance,
   without borrowing the red that belongs to alerts. */
.sidebar { background: linear-gradient(180deg, #152a34 0%, #0f1f27 100%); }
.sidebar .brand small {
  display: inline-block;
  width: max-content;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #9fe0c7;
  background: rgba(159, 224, 199, 0.14);
  font: 600 11px/1.5 var(--body);
}
.sidebar .nav-link,
.sidebar .nav-link-badged {
  color: #b9c8cd;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.sidebar .nav-link:hover:not(:disabled):not(.active) { color: #fff; background: rgba(255, 255, 255, 0.06); }
.sidebar .nav-link:hover:not(.active) .nav-icon { color: #e3ecef; }
.sidebar .nav-link.active {
  color: var(--night);
  background: #eaf4f1;
  font-weight: 600;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.6);
}
.sidebar .nav-link.active .nav-icon { color: #1f7a5f; }
.sidebar .nav-link.active .nav-badge { box-shadow: 0 0 0 2px #eaf4f1; }
.sidebar .nav-link:focus-visible { outline: 2px solid #9fe0c7; outline-offset: 2px; }
.nav-section { display: flex; align-items: center; gap: 10px; margin: 20px 12px 8px; color: #7f969e; font: 500 12px/1.2 var(--body); }
.nav-section::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.08); }
.sidebar-account {
  margin-top: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}
.account-copy small { color: #9fe0c7; }
.account-logout:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.account-logout:focus-visible, .status-beacon:focus-visible { outline: 2px solid #9fe0c7; outline-offset: 2px; }

/* Heading buttons keep their label on one line and wrap as whole buttons. */
@media (max-width: 800px) {
  .family-heading .heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .family-heading .heading-actions .button { width: auto; flex: 1 1 auto; white-space: nowrap; }
}

/* ------------------------------------------------ browser notices ----- */
/* premium-alert-notify.js: the invitation under the beacon, the bell in the
   alerts heading and its settings. */
.notice-prompt {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px 12px;
  margin: -8px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: var(--night-text);
  background: rgba(255, 255, 255, 0.04);
}
.notice-prompt[hidden] { display: none; }
.notice-prompt-icon { display: grid; padding-top: 1px; color: #f3c969; }
.notice-prompt-copy { min-width: 0; display: grid; gap: 2px; }
.notice-prompt-copy strong { color: #fff; font: 600 13px/1.3 var(--body); }
.notice-prompt-copy small { color: var(--night-muted); font: 400 12px/1.4 var(--body); }
.notice-prompt-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.notice-prompt-enable,
.notice-prompt-dismiss { min-height: 32px; padding: 6px 12px; border: 0; border-radius: 8px; font: 600 12.5px/1 var(--body); cursor: pointer; }
.notice-prompt-enable { color: var(--night); background: var(--tint-eaf4f1, #eaf4f1); }
.notice-prompt-enable:hover { background: var(--paper); }
.notice-prompt-dismiss { color: var(--night-muted); background: transparent; font-weight: 500; }
.notice-prompt-dismiss:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.notice-button[data-state="off"] { border-color: var(--night); }
.notice-button[data-state="on"] .portal-icon { color: var(--ok); }
.notice-button[data-state="blocked"] { color: var(--muted); }

.notice-options { display: grid; gap: 10px; margin-top: 6px; }
.notice-options .check-option { align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.notice-options .check-option input { flex: none; width: 18px; min-height: 18px; margin: 2px 4px 0 0; accent-color: var(--night); }
.notice-options .check-option span { display: grid; gap: 3px; }
.notice-options .check-option strong { font: 600 13.5px/1.35 var(--body); }
.notice-options .check-option small { color: var(--muted); font: 400 12.5px/1.45 var(--body); }
.notice-options .check-option.is-blocked { cursor: not-allowed; background: var(--mist); }
.notice-options .check-option.is-blocked small { color: var(--alarm-strong); }
.notice-test { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 4px; }
.notice-test small { flex: 1 1 220px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
/* Filter, bell and refresh stay on one line; when the heading copy would get
   narrower than 320px the three drop below it together. */
@media (min-width: 801px) {
  .alerts-heading { flex-wrap: wrap; }
  .alerts-heading .section-copy { flex: 1 1 320px; }
  .alerts-heading .heading-actions { flex: none; flex-wrap: nowrap; margin-left: auto; }
}

/* ------------------------------------------------------------ account ----- */
/* premium-account.js: the sidebar foot opens the account; the account and
   notifications pages; the printable medical card. */
.sidebar-account { grid-template-columns: minmax(0, 1fr) auto; }
.account-open {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: -4px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.account-open:hover, .account-open.active { background: rgba(255, 255, 255, 0.07); }
.account-open:focus-visible { outline: 2px solid #9fe0c7; outline-offset: 2px; }
.sidebar-account .avatar.has-photo { color: transparent; background-color: #9fe0c7; background-position: center; background-size: cover; }

.account-tabs { margin-bottom: 18px; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 16px; align-items: start; }
.account-side { display: grid; gap: 16px; min-width: 0; }
.account-identity { display: flex; align-items: center; gap: 16px; margin: 4px 0 6px; }
.account-photo { width: 96px; height: 96px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: var(--night); background: var(--tint-9fe0c7, #9fe0c7); font: 700 34px/1 var(--display); }
.account-photo img { width: 100%; height: 100%; object-fit: cover; }
.account-photo-actions { display: grid; gap: 6px; justify-items: start; }
.account-photo-actions small { color: var(--muted); font-size: 12px; }
.account-file { position: relative; overflow: hidden; cursor: pointer; }
.account-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.account-inline { display: flex; gap: 8px; align-items: center; }
.account-inline input { flex: 1; min-width: 0; }
.account-inline .button { flex: none; min-height: 42px; }
.account-facts { display: grid; gap: 8px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--hairline); }
.account-facts div { display: flex; justify-content: space-between; gap: 12px; }
.account-facts dt { color: var(--muted); font-size: 12.5px; }
.account-facts dd { margin: 0; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; text-align: right; }
.account-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; cursor: pointer; }
.account-switch > span { display: grid; gap: 3px; }
.account-switch strong { font: 600 13.5px/1.35 var(--body); }
.account-switch small { color: var(--muted); font: 400 12.5px/1.45 var(--body); }
.account-switch input[role="switch"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 42px;
  min-height: 0;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--hairline-strong);
  cursor: pointer;
  transition: background 160ms ease;
  position: relative;
}
.account-switch input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(19, 36, 44, 0.3); transition: transform 160ms ease; }
.account-switch input[role="switch"]:checked { background: var(--ok); }
.account-switch input[role="switch"]:checked::after { transform: translateX(18px); }
.account-switch input[role="switch"]:disabled { opacity: 0.55; }
.account-note { margin: 12px 0 0; }
.account-phone-only { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.account-phone-only li { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.account-phone-only .portal-icon { flex: none; color: var(--muted); }
.account-phone-only small { color: var(--muted); }
.account-links { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.account-links a { color: var(--night); font-weight: 600; font-size: 13.5px; }

/* Medical card editor */
.medical-form fieldset.card-field { margin: 16px 0 0; padding: 0; border: 0; }
.medical-form legend { padding: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.card-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 11px; border-radius: 999px; background: var(--mist); font-size: 13px; }
.card-chip-remove { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; }
.card-chip-remove:hover { color: var(--alarm-strong); background: var(--paper); }
.card-suggest { display: grid; gap: 6px; margin-top: 10px; }
.card-suggest small { color: var(--muted); font-size: 12px; }
.card-suggest > div { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 11px; border: 1px dashed var(--hairline-strong); border-radius: 999px; color: var(--ink); background: var(--paper); font: 500 12.5px/1.2 var(--body); cursor: pointer; }
.chip-button:hover { border-color: var(--night); }
.card-contact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.card-privacy { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; color: var(--ink); background: var(--mist); font-size: 12.5px; line-height: 1.45; }
.card-privacy .portal-icon { flex: none; margin-top: 1px; color: var(--ink-b25e09, #b25e09); }
.medical-share .account-switch { margin-bottom: 12px; }
.medical-qr { width: min(220px, 100%); margin: 4px auto 12px; padding: 8px; border: 1px solid var(--hairline); border-radius: 12px; background: #fff; }
.medical-qr svg { display: block; width: 100%; height: auto; }
.medical-link input { font-size: 12.5px; color: var(--muted); }
.medical-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.medical-print { display: none; }

/* Notifications */
.notices-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.notice-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.notice-row button { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--hairline); border-radius: 12px; color: var(--ink); background: var(--paper); text-align: left; cursor: pointer; }
.notice-row button:hover { border-color: var(--hairline-strong); }
.notice-row.is-unread button { border-color: rgba(31, 111, 139, 0.35); background: var(--tint-f5fafb, #f5fafb); }
.notice-dot { width: 9px; height: 9px; flex: none; margin-top: 6px; border-radius: 50%; background: #1f6f8b; }
.notice-copy { min-width: 0; display: grid; gap: 3px; }
.notice-copy strong { font: 600 14px/1.35 var(--body); }
.notice-copy span { color: var(--ink); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.notice-copy small { color: var(--muted); font-size: 12px; }

@media (max-width: 1040px) {
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .card-contact { grid-template-columns: 1fr 1fr; }
  .card-contact input[data-contact-field="relation"] { grid-column: 1; }
  .account-identity { flex-direction: column; align-items: flex-start; }
}

/* Printing from the medical card tab prints the wallet card and nothing else. */
@media print {
  body.printing-card > *:not(#portalView) { display: none !important; }
  body.printing-card #portalView > *:not(.portal-main),
  body.printing-card .portal-main > *:not(.portal-page),
  body.printing-card .portal-page:not([data-portal-page="account"]),
  body.printing-card .account-tabs,
  body.printing-card .account-panel > *:not(.medical-print) { display: none !important; }
  body.printing-card, body.printing-card .portal, body.printing-card .portal-main { display: block !important; padding: 0 !important; margin: 0 !important; background: #fff !important; }
  body.printing-card .medical-print { display: block !important; }
  .medical-print-card { display: flex; gap: 6mm; align-items: center; width: 85.6mm; height: 54mm; padding: 4mm; box-sizing: border-box; border: 0.3mm solid #000; border-radius: 3mm; color: #000; font: 10pt/1.3 var(--body); }
  .medical-print-qr { width: 40mm; flex: none; }
  .medical-print-qr svg { width: 100%; height: auto; display: block; }
  .medical-print-card strong { display: block; font-size: 12pt; }
  .medical-print-card p { margin: 1.5mm 0; }
  .medical-print-card small { font-size: 7.5pt; }
}
