/* Lexend, as in Dex; served from node_modules by the Kith server. */
@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/vendor/lexend/lexend-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/vendor/lexend/lexend-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f7f9;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #eff1f5;
  --input: #ffffff;
  --input-border: #d9dde5;
  --search: #eceef3;
  --nav-active: #e9ecf2;
  --text: #1c2130;
  --muted: #646c7e;
  --border: #e3e6ec;
  --accent: #4a6cf7;
  --accent-soft: #edf1ff;
  --accent-strong: #3554d9;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --warn: #a35a00;
  --warn-soft: #fff4e0;
  --ok: #2b7a3d;
  --ok-soft: #eaf7ed;
  --band: #dfe6fb;
  --band-hover: #c4d1fa;
  --star: #e8a400;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --font: "Lexend", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --iti-border-color: var(--border);
  --iti-country-selector-bg: var(--surface);
  --iti-icon-color: var(--muted);
  --iti-hover-color: var(--surface-2);
  color-scheme: light;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 350;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* Dex's navy dark theme, the default (see theme.js). */
:root[data-theme="dark"] {
  --bg: #1d2333;
  --sidebar: #1a1f2d;
  --surface: #1f2636;
  --surface-2: #2a3142;
  --input: #2b3242;
  --input-border: #424a5c;
  --search: #151a26;
  --nav-active: #2c3344;
  --text: #e8eaf0;
  --muted: #9ba3b5;
  --border: #303849;
  --accent: #6d8bff;
  --accent-soft: #28324f;
  --accent-strong: #9db0ff;
  --danger: #ff8787;
  --danger-soft: #3a1f26;
  --warn: #ffc078;
  --warn-soft: #3a2e1b;
  --ok: #8ce99a;
  --ok-soft: #1c3326;
  --band: #263252;
  --band-hover: #34467a;
  --star: #ffc94d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.25), 0 8px 24px rgb(0 0 0 / 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-weight: 500;
  font-size: 1.85rem;
  letter-spacing: -0.015em;
}

h2 {
  font-size: 1.02rem;
  font-weight: 500;
}

strong,
b,
th {
  font-weight: 500;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

code {
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.icon.inline {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

/* ---- layout ---- */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #7b95ff, #4a6cf7);
  color: #fff;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.98rem;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
}

.nav-link.active {
  background: var(--nav-active);
  color: var(--text);
  font-weight: 450;
}

.subnav {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 19px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.nav-group.open .subnav {
  display: flex;
}

.subnav .nav-link {
  padding: 6px 10px;
  font-size: 0.93rem;
}

.nav-bottom {
  margin-top: auto;
  padding-top: 12px;
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.global-search {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 1 520px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--search);
  color: var(--muted);
  font-weight: 400;
}

.global-search:focus-within {
  border-color: var(--input-border);
}

.global-search input {
  border: none;
  background: transparent;
  padding: 8px 0;
  outline: none;
}

.topbar .round {
  border: none;
  background: var(--surface-2);
}

main {
  padding: 32px clamp(16px, 4vw, 48px) 64px;
  max-width: 1240px;
  width: 100%;
  outline: none;
}

main:focus-visible {
  outline: none;
}

main.full-width {
  max-width: none;
  padding: 28px clamp(12px, 3vw, 48px) 24px;
}

.narrow {
  max-width: 820px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.page-sub {
  margin: 6px 0 0;
  max-width: 60ch;
}

.subtle {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.hint {
  margin: -6px 0 14px;
  font-size: 0.88rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card > h2 {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.count {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spaced-top {
  margin-top: 22px;
}

.empty {
  color: var(--muted);
  padding: 6px 0;
  margin: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 64px 16px;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--text);
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0 0 10px;
  max-width: 44ch;
}

.empty-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
}

.callout {
  margin: 24px 0 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* ---- groups ---- */

.group {
  margin-bottom: 26px;
}

.group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

details.group > summary {
  cursor: pointer;
}

/* ---- home ---- */

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
}

.greeting {
  font-size: 2.3rem;
}

.home-section {
  margin-top: 30px;
}

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.home-section-head h2 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}

.section-link {
  font-size: 0.85rem;
  text-decoration: none;
}

.home-rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.rail-title {
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

.rail-list,
.rail-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.93rem;
}

.rail-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.rail-list a span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-list .subtle {
  font-size: 0.8rem;
  flex-shrink: 0;
}

.rail-notes li {
  font-size: 0.9rem;
}

.rail-notes p {
  margin: 2px 0 0;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rail-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.rail-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.rail-stats strong {
  display: block;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.rail-stats span {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- lists ---- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list > li + li {
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  min-width: 0;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

a.row-title:hover {
  text-decoration: underline;
}

.row-sub {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.row-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.row-icon.interaction {
  background: var(--ok-soft);
  color: var(--ok);
}

.timeline-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.filter-chip {
  margin: -6px 0 12px;
  color: var(--muted);
}

/* ---- table ---- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.contact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.contact-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.contact-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.contact-table tr:last-child td {
  border-bottom: none;
}

.contact-table tbody tr:hover {
  background: var(--surface-2);
}

.contact-table .num {
  text-align: right;
  white-space: nowrap;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.muted-cell {
  color: var(--muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-select {
  width: auto;
  padding: 4px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.ghost-select:hover {
  border-color: var(--border);
}

/* ---- avatar ---- */

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 500;
  font-size: 0.85rem;
  color: #172033;
  text-transform: uppercase;
}

.avatar.small {
  width: 26px;
  height: 26px;
  font-size: 0.68rem;
}

.avatar.tiny {
  width: 20px;
  height: 20px;
  font-size: 0.58rem;
}

.avatar.large {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
}

.avatar-0 { background: #8fd3f4; }
.avatar-1 { background: #94dcb3; }
.avatar-2 { background: #f6b3c4; }
.avatar-3 { background: #f9cc95; }
.avatar-4 { background: #bfb0f7; }
.avatar-5 { background: #8be0e0; }
.avatar-6 { background: #cfe39a; }
.avatar-7 { background: #e5b3ee; }

/* ---- pills & tags ---- */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill.overdue { background: var(--danger-soft); color: var(--danger); }
.pill.due_soon { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.untracked { background: var(--surface-2); color: var(--muted); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  text-decoration: none;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
}

.dot.overdue {
  background: var(--danger);
}

/* ---- buttons & forms ---- */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  border-color: var(--muted);
}

.button.primary,
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary.danger-fill {
  background: var(--danger);
  border-color: var(--danger);
}

button.small,
.button.small {
  padding: 3px 10px;
  font-size: 0.8rem;
}

button.danger {
  color: var(--danger);
}

button.link {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

button.link:hover {
  color: var(--danger);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.icon-button.round {
  border-radius: 50%;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 14px;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  margin-top: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

/* Fields built around a widget (phone, location) match the plain labelled inputs. */
.form-grid .field {
  gap: 4px;
  font-size: 0.85rem;
}

.form-grid .field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.dex-dialog .field {
  font-size: 0.98rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.field-error {
  color: var(--danger);
  font-weight: 500;
  font-size: 0.8rem;
}

.form-error {
  margin: 12px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar input[type="search"] {
  flex: 1 1 240px;
}

.toolbar select {
  width: auto;
  flex: 0 1 190px;
}

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-2);
}

.tab {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---- contact detail ---- */

.profile {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-main {
  flex: 1;
  min-width: 200px;
}

.profile-main p {
  margin: 2px 0 6px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin-top: 24px;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.kit-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kit-status {
  font-size: 0.92rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 18px 26px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}

.timeline li:last-child::before {
  display: none;
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ok);
}

.timeline li.is-event::after {
  border-color: var(--accent);
}

.timeline-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.timeline-kind {
  font-weight: 600;
}

.timeline-body {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reminder {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
}

.reminder input {
  width: auto;
  margin-top: 4px;
}

.reminder.done .reminder-title {
  text-decoration: line-through;
  color: var(--muted);
}

/* ---- birthdays & locations ---- */

.subtle.today {
  color: var(--accent);
  font-weight: 600;
}

.subtle.past {
  opacity: 0.75;
}

.location-list summary {
  cursor: pointer;
  list-style: none;
}

.location-list summary::-webkit-details-marker {
  display: none;
}

.list.nested {
  margin: 0 0 8px 44px;
}

.bar {
  position: relative;
  flex: 0 0 140px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  background: var(--accent);
}

/* ---- merge & fix ---- */

.merge-reasons {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.merge-sides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
}

.merge-side {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.merge-side input {
  width: auto;
}

.merge-side.keep {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.merge-side-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.keep-label {
  visibility: hidden;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-transform: uppercase;
}

.merge-side.keep .keep-label {
  visibility: visible;
}

/* ---- keep in touch board ---- */

.kit-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kit-column {
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
  min-height: 320px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 2px dashed transparent;
}

.kit-column.drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.kit-column-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px 8px;
  font-size: 0.92rem;
  font-weight: 500;
}

.kit-cards {
  list-style: none;
  margin: 0;
  padding: 4px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.kit-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
  font-size: 0.9rem;
}

.kit-card a {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kit-card.dragging {
  opacity: 0.4;
}

.grip {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: -2px;
}

.kit-empty {
  padding: 20px 8px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- priority map ---- */

.priority-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.priority-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.priority-map {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 600;
}

.panel-title {
  font-size: 1.35rem;
}

.priority-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.band {
  fill: var(--band);
  stroke: color-mix(in srgb, var(--accent) 35%, transparent);
  stroke-width: 1;
  transition: fill 0.15s;
}

.band.hover {
  fill: var(--band-hover);
}

.you-ring {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
}

.you {
  fill: var(--accent);
}

.you-text {
  fill: #fff;
  font: 700 26px ui-sans-serif, system-ui, sans-serif;
}

.tier-label,
.map-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.tier-label {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78rem;
  color: var(--muted);
  transform: translate(-100%, -50%);
  pointer-events: none;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78rem;
  box-shadow: var(--shadow);
  cursor: grab;
}

.map-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-chip.match {
  outline: 2px solid var(--accent);
}

.map-chip.more {
  padding: 3px 10px;
  color: var(--accent-strong);
  cursor: pointer;
}

.map-chip.dragging,
.tray-chip.dragging {
  opacity: 0.4;
}

.tray {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.tray.drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tray-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.tray-title {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.tray-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tray-nav {
  flex-shrink: 0;
  font-size: 1.2rem;
}

.tray-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  scrollbar-width: thin;
}

.tray-chip {
  flex-direction: column;
  width: 96px;
  padding: 6px 4px;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 400;
  cursor: grab;
}

.tray-chip span:last-child {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-panel {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.priority-panel p {
  margin: 0;
}

.panel-sub {
  margin-top: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.level-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.level-list li {
  display: grid;
  grid-template-columns: 80px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.level-list .bar {
  flex: none;
}

.level-list .count {
  text-align: right;
}

.how-to {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--muted);
}

.level-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.tier-members {
  max-height: 50vh;
  overflow-y: auto;
}

/* ---- import ---- */

.dropzone {
  display: block;
  padding: 28px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}

.dropzone input {
  margin-top: 12px;
}

.result {
  margin-top: 14px;
}

.result ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--danger);
}

/* ---- dialog & toast ---- */

dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(3px);
}

dialog h2 {
  margin-bottom: 16px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dialog-head .icon-button {
  border: none;
}

.dialog-sub {
  margin: 20px 0 10px;
  font-size: 0.95rem;
}

.calendar-dialog > .list {
  margin-bottom: 8px;
}

.instructions {
  margin: 12px 0 14px;
  font-size: 0.9rem;
}

.steps {
  margin: 0 0 8px;
  padding-left: 20px;
}

.steps li + li {
  margin-top: 4px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 10;
}

.toast button {
  background: transparent;
  color: inherit;
  border-color: color-mix(in srgb, var(--bg) 40%, transparent);
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

[hidden] {
  display: none !important;
}

/* ---- "+" menu ---- */

.plus-menu {
  position: relative;
}

.plus-menu .round {
  margin-left: 0;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.3);
}

.menu button {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  font-size: 0.95rem;
}

.menu button:hover,
.menu button:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.menu kbd {
  margin-left: auto;
}

.menu hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--border);
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: 500 0.75rem ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
  text-align: center;
}

/* ---- sidebar groups ---- */

.nav-groups {
  margin-top: 14px;
}

.nav-groups summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.nav-groups summary::-webkit-details-marker {
  display: none;
}

.nav-groups ul {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}

.icon-button.tiny {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
}

.icon-button.tiny .icon {
  width: 14px;
  height: 14px;
}

.group-link {
  padding: 5px 10px;
  font-size: 0.9rem;
}

.group-link.depth-1 { padding-left: 26px; }
.group-link.depth-2 { padding-left: 42px; }
.group-link.depth-3 { padding-left: 58px; }

.group-emoji {
  width: 18px;
  text-align: center;
}

.group-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-empty {
  padding: 4px 10px;
  font-size: 0.82rem;
}

/* ---- Dex-style dialogs ---- */

.dex-dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dex-dialog h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 400;
}

.dex-dialog label,
.dex-dialog .field-label {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 400;
  gap: 8px;
}

.dex-dialog input:not([type="checkbox"]):not([type="date"]):not(.picker-input):not(.iti__search-input) {
  padding: 10px 14px;
}

.dex-dialog .form-actions {
  margin-top: 4px;
}

.required {
  color: var(--danger);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 16px;
}

.more-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.92rem;
  font-weight: 500;
}

.text-button {
  align-self: flex-start;
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--muted);
}

.text-button:hover {
  color: var(--text);
}

.form-actions .text-button,
.note-footer .text-button {
  align-self: center;
  padding: 7px 10px;
}

.pill-button {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--muted);
}

.dashed-button {
  padding: 5px 14px;
  border: 1px dashed var(--muted);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.spacer {
  flex: 1;
}

.date-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input);
}

.date-field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.date-field input:not(.date-proxy),
.date-field input:not(.date-proxy):focus-visible {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
}

.date-field {
  position: relative;
  max-width: 260px;
}

.date-picker-button {
  padding: 0 10px;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
}

/* The native picker only provides the calendar popup; the text field shows DD.MM.YYYY. */
.date-proxy {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---- pickers & chips ---- */

.picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.chip-x {
  padding: 2px;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
}

.picker > .picker-input {
  flex: 1;
  min-width: 160px;
  padding: 6px 0;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  outline: none;
}

[data-groups] .picker-input {
  margin-top: 8px;
}

.picker-results {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 5;
  width: min(360px, 100%);
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.3);
}

.picker-results li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.picker-results li.active,
.picker-results li:hover {
  background: var(--surface-2);
}

/* ---- group dialog ---- */

.emoji-name {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.emoji-name:focus-within {
  outline: 2px solid var(--accent);
}

.emoji-name input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.05rem;
}

.emoji-button {
  padding: 4px 8px;
  border: none;
  background: none;
  font-size: 1.25rem;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.emoji-grid button {
  padding: 6px;
  border: none;
  background: none;
  font-size: 1.2rem;
}

.emoji-grid button:hover {
  background: var(--surface-2);
}

.emoji-grid .no-emoji {
  grid-column: span 2;
  font-size: 0.8rem;
  color: var(--muted);
}

.parent-row label {
  max-width: 320px;
}

/* ---- note dialog ---- */

dialog:has(.note-dialog) {
  width: min(760px, calc(100vw - 32px));
}

.eyebrow {
  font-weight: 600;
}

.note-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.voice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--accent);
}

.voice.listening {
  color: var(--danger);
}

.voice.listening .icon {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.note-text {
  min-height: 300px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  resize: vertical;
  outline: none;
}

.note-reminder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 200px) 170px;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.note-footer,
.reminder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pill-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.pill-field input,
.pill-field select {
  width: auto;
  border: none;
  background: transparent;
  padding: 8px 12px 8px 0;
}

.pill-field:has(select) {
  padding: 0 12px 0 0;
}

.pill-field:has(select) select {
  padding-left: 12px;
}

.reminder-contact .picker {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.reminder-contact .picker > .picker-input {
  font-size: 0.95rem;
}

/* ---- phone field (intl-tel-input) ---- */

.iti {
  display: block;
  width: 100%;
}

.iti__selected-country {
  border-radius: 10px 0 0 10px;
}

.iti__selected-country:hover,
.iti__selected-country[aria-expanded="true"] {
  background: var(--surface-2);
}

.iti__selected-dial-code {
  color: var(--muted);
}

.iti .iti__country-selector {
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.3);
  overflow: hidden;
}

.iti input.iti__search-input {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.iti__country.iti__highlight {
  background: var(--surface-2);
}

.iti__dial-code {
  color: var(--muted);
}

/* ---- location field ---- */

.location-field {
  position: relative;
}

.location-field .picker-results,
.map-search .picker-results {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
}

.picker-results li .subtle {
  margin-left: auto;
  font-size: 0.8rem;
}

.picker-results li.typed {
  color: var(--muted);
}

/* ---- social profiles ---- */

.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-fieldset {
  margin: 0;
  padding: 10px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.social-fieldset legend {
  padding: 0 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.icon-button.social {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.icon-button.social:hover {
  color: var(--text);
  border-color: var(--muted);
}

.profile-main h1 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button.star {
  border: none;
  background: none;
  color: var(--muted);
}

.icon-button.star:hover {
  color: var(--star);
}

.icon-button.star.on {
  color: var(--star);
}

.icon-button.star.on svg {
  fill: currentColor;
}

.icon-button.ghost {
  border: none;
  background: none;
  color: var(--muted);
}

.icon-button.ghost:hover,
.icon-button.ghost.active,
.icon-button.ghost[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--text);
}

.icon-button.tiny-round {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.icon-button.tiny-round .icon {
  width: 15px;
  height: 15px;
}

/* ---- sidebar favorites ---- */

.favorite-link {
  padding: 5px 10px;
  font-size: 0.9rem;
}

.summary-chevron {
  display: inline-grid;
  margin-right: 4px;
  transition: transform 0.15s;
}

.summary-chevron .icon {
  width: 14px;
  height: 14px;
}

details:not([open]) > summary .summary-chevron {
  transform: rotate(-90deg);
}

/* ---- map ---- */

.map-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 400px);
  gap: 16px;
  height: calc(100vh - 110px);
  min-height: 480px;
}

.map-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.map-search {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: min(300px, calc(100% - 28px));
}

.map-search-box {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(6px);
  color: var(--muted);
  font-weight: 400;
}

.map-search-box:focus-within {
  border-color: var(--accent);
}

.map-search-box input,
.map-search-box input:focus-visible {
  padding: 9px 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.map-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.map-list-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.map-list-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.popover {
  position: relative;
}

.popover .menu {
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
}

.menu-check {
  margin-left: auto;
  visibility: hidden;
}

[aria-checked="true"] > .menu-check {
  visibility: visible;
}

.map-list {
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.map-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 10px;
  border-bottom: 1px solid var(--border);
}

.map-list li:hover {
  background: var(--surface-2);
}

.map-list li a {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
}

.map-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-list-meta {
  font-size: 0.8rem;
  white-space: nowrap;
}

.map-list li.map-list-empty {
  padding: 16px;
  border: none;
}

.map-list li.map-list-empty:hover {
  background: none;
}

.map-unplaced {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.map-locations-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.map-locations-link:hover {
  border-color: var(--muted);
}

.map-locations-link strong,
.map-locations-link .subtle {
  display: block;
}

.map-locations-link .subtle {
  font-size: 0.85rem;
}

.map-locations-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.map-token-change {
  align-self: center;
  font-size: 0.82rem;
}

.map-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.map-setup h2 {
  color: var(--text);
  font-size: 1.2rem;
}

.map-setup p {
  max-width: 54ch;
  margin: 0;
}

.map-token-form {
  display: flex;
  gap: 8px;
  width: min(480px, 100%);
  margin: 8px 0;
}

.map-token-form button {
  white-space: nowrap;
}

/* Mapbox positions markers with `transform`, so effects go on the avatar inside. */
.map-pin {
  position: relative;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.map-pin .avatar {
  width: 44px;
  height: 44px;
  font-size: 1rem;
  border: 2px solid rgb(255 255 255 / 0.9);
  box-shadow: 0 3px 12px rgb(0 0 0 / 0.45);
  transition: transform 0.15s;
}

.map-pin:hover .avatar,
.map-pin.highlight .avatar {
  transform: scale(1.15);
}

.map-pin.highlight {
  z-index: 2;
}

.map-pin-count {
  position: absolute;
  top: -5px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.mapboxgl-popup-content {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  font-family: var(--font);
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
  border-top-color: var(--surface);
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
  border-bottom-color: var(--surface);
}

.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
  border-right-color: var(--surface);
}

.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
  border-left-color: var(--surface);
}

.map-popup-place {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.map-popup ul {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.map-popup a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--text);
  text-decoration: none;
}

.map-popup a:hover span {
  text-decoration: underline;
}

.mapboxgl-ctrl-group:not(:empty) {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}

.mapboxgl-ctrl-group button + button {
  border-top-color: var(--border);
}

:root[data-theme="dark"] .mapboxgl-ctrl-icon {
  filter: invert(1) brightness(0.9);
}

/* ---- resurface & shuffle ---- */

.shuffle-button {
  position: relative;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e5737c;
  color: #2a1015;
  font-size: 0.7rem;
  font-weight: 600;
}

.resurface-card {
  margin-top: 26px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
}

.resurface-card .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.resurface-card.done {
  border-color: var(--border);
  background: var(--surface);
}

.resurface-card.done p {
  margin: 4px 0 0;
}

.resurface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -4px -6px 6px 0;
}

.resurface-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.resurface-body p {
  margin: 4px 0 0;
}

.resurface-name {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 500;
  text-decoration: none;
}

.resurface-name:hover {
  text-decoration: underline;
}

.resurface-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

dialog:has(.spotlight-dialog) {
  width: min(600px, calc(100vw - 32px));
  padding: 28px 30px 22px;
}

.spotlight-dialog {
  position: relative;
}

.dialog-close {
  position: absolute;
  top: -10px;
  right: -12px;
  z-index: 1;
}

.spotlight-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.spotlight-head .avatar {
  width: 76px;
  height: 76px;
  font-size: 1.7rem;
}

.spotlight-who h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 450;
}

.spotlight-who h2 a {
  color: var(--text);
  text-decoration: none;
}

.spotlight-who h2 .icon {
  color: var(--accent);
}

.spotlight-who p {
  margin: 2px 0 0;
}

.spotlight-reach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spotlight-reach .social-links {
  margin-top: 10px;
}

.spotlight-why {
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.spotlight-why p {
  margin: 6px 0 0;
  font-size: 1.02rem;
}

.spotlight .eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.spotlight-facts {
  margin: 18px 0;
}

.spotlight-facts dt {
  margin-top: 12px;
}

.spotlight-facts dd {
  margin: 4px 0 0;
}

.spotlight > h3 {
  margin: 22px 0 10px;
}

.spotlight-steps {
  border: 1px solid var(--border);
  border-radius: 12px;
}

.spotlight-step {
  padding: 14px 16px;
}

.spotlight-step + .spotlight-step {
  border-top: 1px solid var(--border);
}

.spotlight-step h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 500;
}

.step-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--search);
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.spotlight-footer {
  position: sticky;
  bottom: -22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px -30px -22px;
  padding: 14px 30px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.shuffle-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 48px 0 30px;
  text-align: center;
}

.shuffle-deck {
  position: relative;
  width: min(340px, 80vw);
  height: 120px;
}

.shuffle-card {
  position: absolute;
  inset: 0;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
}

.shuffle-card.behind.one {
  transform: rotate(-5deg) translate(-8px, 10px);
  opacity: 0.6;
}

.shuffle-card.behind.two {
  transform: rotate(4deg) translate(10px, 8px);
  opacity: 0.8;
}

.shuffle-card.front {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  font-size: 1.1rem;
}

.shuffle-card.front.flip {
  animation: shuffle-flip 0.35s ease-out;
}

@keyframes shuffle-flip {
  from {
    transform: translateY(-14px) rotate(-3deg);
    opacity: 0.3;
  }
}

.shuffle-empty {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .shuffle-card.front.flip {
    animation: none;
  }
}

/* ---- sign-in (Clerk) ---- */

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg);
}

.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(440px, 100%);
}

.auth-card .brand {
  padding: 0;
  font-size: 1.4rem;
}

.auth-intro {
  margin: 0 0 6px;
  text-align: center;
  color: var(--muted);
}

.auth-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-switch {
  align-self: center;
}

.user-button {
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
}

/* ---- responsive ---- */

@media (max-width: 1080px) {
  .home-layout,
  .priority-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-rail {
    padding-left: 0;
    border-left: none;
  }

  .priority-panel {
    position: static;
  }
}

@media (max-width: 980px) {
  .map-page {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .map-card {
    height: 60vh;
  }
}

@media (max-width: 860px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding: 0 8px 0 0;
  }

  .nav-group {
    display: contents;
  }

  .nav-group.open .subnav {
    order: 10;
    flex-basis: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
  }

  .nav-bottom {
    margin: 0;
    padding: 0;
  }

  .nav-link [data-icon] {
    display: none;
  }

  .topbar {
    position: static;
  }

  h1 {
    font-size: 1.7rem;
  }

  .tier-label {
    display: none;
  }

  .map-chip span:last-child {
    display: none;
  }

  .map-chip {
    padding: 3px;
  }
}
