:root {
  color-scheme: light;
  --ink: #182d25;
  --muted: #56645b;
  --page: #f3f5ef;
  --paper: #fffefa;
  --line: #dce2d8;
  --green: #183b2f;
  --highlight: #e5eee1;
  --red: #9b362d;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 290px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { font-size: clamp(2.5rem, 5vw, 4.3rem); letter-spacing: -.055em; line-height: 1.02; }
h2 { font-size: 1.85rem; letter-spacing: -.035em; }
h3 { font-size: 1rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); border-radius: .7rem; padding: .62rem .9rem;
  background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 600;
}
button:hover, .button:hover { background: var(--highlight); }
.primary { background: var(--green); color: white; border-color: var(--green); }
.primary:hover { background: #275344; }
:focus-visible { outline: 3px solid #8eae73; outline-offset: 3px; }
input, textarea, select {
  width: 100%; border: 1px solid #cbd5c8; border-radius: .65rem; padding: .68rem .75rem;
  background: white; color: var(--ink);
}
textarea { resize: vertical; min-height: 5.6rem; }
label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; }
.workspace { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  gap: 3rem; padding: 1.9rem 1.15rem; background: #18332b; color: #eaf0e5;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; font: 1.37rem/1.03 Georgia, serif; }
.monogram {
  flex: none; display: inline-grid; place-items: center; width: 2.8rem; height: 2.8rem;
  border: 1px solid #778f71; border-radius: .85rem; font: 1.8rem Georgia, serif;
  color: #e6eccd;
}
nav { display: grid; gap: .32rem; }
nav a, .logout {
  display: flex; align-items: center; gap: .75rem; padding: .72rem .8rem; border-radius: .55rem;
  background: transparent; border: 0; color: #c3d1c4; text-decoration: none; font-size: .95rem;
}
nav a span { width: 1rem; text-align: center; }
nav a[aria-current], nav a:hover, .logout:hover { background: #2d4c3e; color: white; }
.logout { margin-top: auto; justify-content: flex-start; }
.content { max-width: 1430px; width: 100%; margin: 0 auto; padding: clamp(1.2rem, 4vw, 3.4rem); }
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.eyebrow { color: #526651; font-size: .78rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; margin-bottom: .6rem; }
.muted { color: var(--muted); }
.notice { color: #294939; background: #e4eee0; padding: .7rem 1rem; border-radius: .65rem; margin-bottom: 1rem; }
.error, .danger { color: var(--red); }
.error:empty { display: none; }
.directory-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.open-tasks { flex-wrap: wrap; justify-content: flex-start; border-color: #bdcfbb; background: #e6eee2; }
.open-tasks strong { min-width: 1.5rem; border-radius: 1rem; padding: .1rem .38rem; background: var(--green); color: white; text-align: center; }
.open-tasks .overdue { font-size: .875rem; }
.directory-count { display: block; margin-top: .55rem; font-size: .85rem; }
.import-preview { margin: 0; padding-inline-start: 1.25rem; overflow-wrap: anywhere; }
.directory { display: grid; grid-template-columns: minmax(13rem, .72fr) minmax(0, 1.28fr); align-items: start; gap: 1rem; }
.panel { border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); padding: 1.15rem; min-width: 0; }
.contact-list { display: grid; gap: .4rem; margin-top: .85rem; }
.contact-row {
  justify-content: flex-start; text-align: left; width: 100%; gap: .65rem;
  border-color: transparent; padding: .65rem .55rem;
}
.contact-row[aria-current] { background: var(--highlight); border-color: #d1dfcf; }
.contact-row span:last-child, .info span, .item strong, .item .muted { overflow-wrap: anywhere; }
.contact-row small { display: block; color: var(--muted); font-weight: 400; margin-top: .15rem; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem;
  border-radius: 50%; background: #dce8d6; color: #34513b; font-weight: 750;
}
.avatar.large { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem .75rem; display: grid; gap: .65rem; justify-items: center; }
.empty h2 { color: var(--ink); }
.row, .actions { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.spaced { justify-content: space-between; }
.stack { display: grid; gap: .85rem; }
.detail-head { display: flex; align-items: center; gap: .8rem; }
.detail-head h2 { overflow-wrap: anywhere; }
.info-grid, .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.info { display: grid; gap: .25rem; align-content: start; }
.info small { color: var(--muted); }
.preserve { white-space: pre-wrap; }
.full { grid-column: 1 / -1; }
.detail-section { display: grid; gap: .7rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; justify-content: space-between; gap: .65rem; border-radius: .65rem; padding: .55rem .65rem; background: #f2f5ee; }
.item .muted { font-size: .85rem; }
.overdue { color: var(--red); font-weight: 650; }
.done strong { text-decoration: line-through; }
.icon { padding: .35rem .62rem; }
.text-button { padding: .3rem .5rem; font-size: .85rem; }
.calendar-items { display: grid; gap: .55rem; }
.content:has(.calendar-panel) { max-width: none; padding-inline: clamp(.55rem, 2vw, 1.65rem); padding-top: 1rem; }
.content:has(.calendar-panel) .heading { display: none; }
.calendar-panel { width: 100%; }
.calendar-toolbar h2 { font-variant-numeric: tabular-nums; }
.calendar-toolbar h2::first-letter { text-transform: uppercase; }
.calendar-nav { min-width: 2.6rem; min-height: 2.45rem; padding: .15rem .55rem; font-size: 1.35rem; line-height: 1; }
.calendar-check { display: flex; align-items: center; gap: .4rem; min-height: 2.25rem; }
.calendar-check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--green); }
.calendar-modes { display: inline-flex; gap: .2rem; padding: .18rem; border-radius: .75rem; background: #edf1ea; }
.calendar-modes button { border-color: transparent; background: transparent; padding: .38rem .55rem; font-size: .85rem; }
.calendar-modes button[aria-pressed="true"] { background: var(--paper); border-color: var(--line); color: var(--green); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .32rem; }
.calendar-month { grid-template-rows: auto; grid-auto-rows: minmax(6.75rem, 1fr); min-height: calc(100dvh - 13rem); }
.calendar-week-scroll { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; padding: 3px 3px .55rem; }
.calendar-week { grid-template: auto 1fr / repeat(7, minmax(9.5rem, 1fr)); min-height: calc(100dvh - 13rem); }
.calendar-weekday { padding: .18rem .45rem; color: var(--muted); font-size: .78rem; font-weight: 650; }
.calendar-day {
  display: grid; grid-template-columns: auto 1fr; align-items: start; align-content: start; text-align: left;
  min-height: 6rem; min-width: 0; padding: .38rem .45rem; border-radius: .48rem; gap: .25rem;
  font-variant-numeric: tabular-nums;
}
.calendar-week .calendar-day { min-height: 10.5rem; }
.calendar-day-num { font-size: .8rem; line-height: 1.15; padding: .13rem .15rem; }
.calendar-day.calendar-weekend { background: #f6f7f2; }
.calendar-weekend .calendar-day-num { color: #8d4830; }
.calendar-day.calendar-outside { background: #f2f4ef; }
.calendar-outside .calendar-day-num { color: var(--muted); }
.calendar-today .calendar-day-num { color: white; background: var(--green); border-radius: .3rem; }
.calendar-day:hover { background: var(--highlight); }
.calendar-day[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.calendar-previews { grid-column: 1 / -1; display: grid; gap: .17rem; min-width: 0; }
.calendar-preview {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 550;
  font-size: .72rem; line-height: 1.35; padding: .12rem .25rem;
  border-inline-start: 2px solid #6b8867; border-radius: .2rem; background: #e9f0e5;
}
.calendar-week .calendar-preview {
  white-space: normal; overflow-wrap: anywhere; font-size: .85rem; padding: .3rem .4rem;
}
.calendar-week .calendar-previews { gap: .3rem; }
.calendar-preview-leader { border-inline-start-color: #537fab; background: #e8eef5; }
.calendar-preview-late { border-inline-start-color: var(--red); }
.calendar-preview-done { text-decoration: line-through; color: var(--muted); }
.calendar-preview-more { font-size: .71rem; color: var(--muted); }
.calendar-day-count { display: none; }
.calendar-day-tasks { padding-top: .7rem; border-top: 1px solid var(--line); }
.calendar-export { padding-top: .25rem; }
.settings-page { width: min(100%, 47rem); }
.settings-status { padding: .18rem .55rem; border-radius: 1rem; color: var(--muted); background: #edf0ea; font-size: .85rem; }
.settings-checks { display: grid; gap: .15rem; }
.settings-days { width: fit-content; }
.settings-days input { width: 6rem; }
.graph-map {
  position: relative; border: 1px solid #d5dfd3; border-radius: 1rem; overflow: hidden;
  background: #f0f4ed radial-gradient(circle, #a4b7a688 1px, transparent 1px) 0 0 / 17px 17px;
}
.map-canvas { display: block; width: 100%; height: auto; max-height: 34rem; touch-action: pan-y; cursor: grab; }
.map-canvas:active { cursor: grabbing; }
.map-canvas a { cursor: pointer; }
.map-node rect { fill: var(--paper); stroke: var(--edge, #708578); stroke-width: 1.4; }
.map-node text { fill: var(--ink); text-anchor: middle; font-size: 13px; font-weight: 680; }
.map-node .map-subtitle { fill: var(--muted); font-size: 11px; font-weight: 500; }
.map-center rect { fill: var(--green); stroke: var(--green); }
.map-center text, .map-center .map-subtitle { fill: white; }
.map-canvas a:hover rect, .map-canvas a:focus-visible rect { stroke-width: 3; }
.map-edges line { stroke: #6d8073; stroke-width: 1.6; }
.map-tools { display: flex; gap: .4rem; padding: .5rem; border-top: 1px solid #d5dfd3; background: #f9fbf7; }
.map-tools button { min-width: 2.75rem; min-height: 2.75rem; padding: .35rem .65rem; }
.graph-people a:hover { background: var(--highlight); }
.graph-people {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .55rem;
  list-style: none; padding: 0; margin: 0;
}
.graph-people a {
  display: grid; align-content: start; gap: .2rem; height: 100%; padding: .65rem .75rem;
  border: 1px solid var(--line); border-radius: .65rem; text-decoration: none; overflow-wrap: anywhere;
}
.graph-pagination { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.graph-pagination button:disabled { cursor: default; }
.graph-focus-title { min-width: 0; overflow-wrap: anywhere; }
.graph-filters { gap: .7rem 1rem; align-items: end; }
.graph-filters label { flex: 0 1 auto; min-width: 0; }
.graph-filters .graph-check {
  display: flex; align-items: center; gap: .45rem; min-height: 2.75rem;
}
.graph-check input { width: 1rem; height: 1rem; flex: none; accent-color: var(--green); }
.graph-neighbor {
  min-width: 0; border: 1px solid #d1dbce; border-radius: .65rem; background: var(--paper);
  overflow-wrap: anywhere; padding: .55rem .65rem; display: grid; gap: .35rem;
}
.graph-connection-list { margin-top: .5rem; }
.graph-neighbor a { display: inline-flex; height: auto; }
.graph-person { font-weight: 700; }
.graph-meta, .graph-neighbor summary { font-size: .875rem; }
.graph-labels { padding-inline-start: 1.2rem; margin: .35rem 0 .1rem; }
.graph-neighbor summary { cursor: pointer; }
[data-kind="friends"] { --edge: #17755d; }
[data-kind="family"] { --edge: #b04962; }
[data-kind="work"] { --edge: #2b63a5; }
[data-kind="projects"] { --edge: #a25b18; }
[data-kind="community"] { --edge: #70499b; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: #18332b; }
.login-panel { background: var(--paper); width: min(100%, 475px); border-radius: 1.3rem; padding: clamp(1.3rem, 6vw, 2.7rem); display: grid; gap: 1rem; }
.login-panel .monogram { background: var(--green); }
.login-panel h1 { font-size: clamp(2.3rem, 7vw, 3.7rem); }
.login-panel p { color: var(--muted); }
.login-panel .error { color: var(--red); }
dialog { width: min(calc(100% - 1rem), 680px); max-height: calc(100dvh - 1rem); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #12251e99; }
.glass-overlay {
  border-color: #ffffffd9; background: #f6f8f2; box-shadow: 0 16px 48px #132a2440;
}
.glass-overlay::backdrop { background: #14281e50; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-overlay::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .glass-overlay { background: #f8faf1e0; -webkit-backdrop-filter: blur(20px) saturate(135%); backdrop-filter: blur(20px) saturate(135%); }
}
body:has(.glass-overlay[open]) { overflow: hidden; }
.calendar-overlay {
  inset: 0; margin: auto; width: min(calc(100% - 1rem), 42rem); max-height: min(80dvh, 42rem);
  overflow: hidden; padding: 0; border-radius: 1.3rem;
}
.calendar-overlay[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.calendar-overlay-head { padding: .8rem 1rem; }
.calendar-overlay-head h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
.calendar-overlay-head h2::first-letter { text-transform: uppercase; }
.calendar-overlay-head button { min-height: 44px; }
.calendar-overlay-body { overflow: auto; overscroll-behavior: contain; padding: 0 1rem 1rem; }
.calendar-overlay-body .item { background: #ffffffe0; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: 1rem; }
#dialog-error { margin-top: .7rem; }
.capture-modes { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 180px minmax(0, 1fr); }
  .directory { grid-template-columns: minmax(0, 1fr); }
  dialog.contact-overlay {
    inset: auto 0 0; width: min(100% - .75rem, 42rem); max-width: none; max-height: none;
    height: calc(100dvh - max(4.5rem, env(safe-area-inset-top) + 2.5rem)); margin: 0 auto;
    padding: 0; border: 1px solid #ffffffd9; border-bottom: 0; border-radius: 1.6rem 1.6rem 0 0;
    box-shadow: 0 -12px 48px #132a2440; overflow: hidden;
  }
  .contact-overlay[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .contact-overlay-top {
    position: relative; padding: 1.1rem .85rem .5rem; touch-action: none;
  }
  .contact-sheet-back { min-height: 44px; background: #ffffffe0; }
  .contact-sheet-grabber {
    position: absolute; top: .48rem; left: 50%; width: 2.2rem; height: .23rem;
    transform: translateX(-50%); background: #6f8372; border-radius: 1rem;
  }
  .contact-sheet-body {
    overflow: auto; overscroll-behavior: contain; padding: 0 .75rem max(1rem, env(safe-area-inset-bottom));
  }
  .contact-overlay article {
    margin: 0 auto; padding: .9rem; border-color: #fff; border-radius: 1.1rem; background: #ffffffe0;
  }
  .contact-overlay article .info { min-width: 0; overflow-wrap: anywhere; }
  .contact-overlay article .button, .contact-overlay article button { min-height: 44px; }
  @media (prefers-reduced-motion: no-preference) {
    .contact-overlay[open]:not(.contact-sheet-restored) { animation: contact-sheet-open .22s ease-out both; }
    @keyframes contact-sheet-open { from { transform: translateY(3rem); opacity: .6; } }
  }
  #dialog { max-height: calc(100dvh - 1rem); }
}
@media (max-width: 1030px) {
  .calendar-month { grid-auto-rows: minmax(3.2rem, 1fr); }
  .calendar-month .calendar-day { min-height: 3.2rem; }
  .calendar-month .calendar-previews { display: none; }
  .calendar-day-count {
    display: block; grid-column: 1 / -1; justify-self: start;
    color: #fff; background: var(--green); border-radius: 1rem; font-size: .72rem; padding: .05rem .36rem;
  }
  .calendar-overdue { background: var(--red); }
  .calendar-completed { background: #586866; }
}
@media (max-width: 740px) {
  .workspace { display: block; }
  .sidebar { position: static; height: auto; padding: .75rem; gap: .65rem; display: grid; grid-template-columns: 1fr auto; }
  .brand { font-size: 1.1rem; }
  .brand br { display: none; }
  .brand .monogram { width: 2rem; height: 2rem; font-size: 1.3rem; }
  nav {
    position: fixed; inset: auto 0 0; z-index: 4; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0; padding: .25rem max(.2rem, env(safe-area-inset-right)) max(.25rem, env(safe-area-inset-bottom)) max(.2rem, env(safe-area-inset-left));
    border-top: 1px solid var(--line); background: var(--paper); color: var(--ink);
  }
  nav a {
    flex-direction: column; justify-content: center; gap: .12rem; min-height: 3.15rem;
    padding: .22rem .08rem; color: var(--muted); font-size: .74rem; font-weight: 650;
  }
  nav a[aria-current], nav a:hover { color: var(--green); background: var(--highlight); }
  nav a span { font-size: 1.05rem; line-height: 1; }
  .logout { padding: .5rem .55rem; gap: .3rem; }
  .logout { margin: 0; }
  .heading { align-items: flex-start; flex-direction: column; margin-bottom: 1.2rem; }
  .content { padding-bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
  .calendar-grid { gap: .2rem; }
  .calendar-month, .calendar-week { min-height: calc(100dvh - 19rem); }
  .calendar-panel { padding: .75rem; }
  .calendar-weekday { padding: .15rem .2rem; }
  .calendar-month .calendar-day { min-height: 2.8rem; padding: .2rem .16rem; gap: .15rem; }
  .calendar-day-count { font-size: .68rem; padding: 0 .23rem; line-height: 1.2; }
}
@media (max-width: 420px) {
  .fields, .info-grid { grid-template-columns: 1fr; }
}
@media (display-mode: standalone) and (max-width: 740px) {
  .sidebar { padding-top: max(.75rem, env(safe-area-inset-top)); }
  .login { padding-top: max(1rem, env(safe-area-inset-top)); }
}
