/* Estate Ops — professional estate management UI */
:root {
  --navy: #1F4E79;
  --navy-dark: #163A5C;
  --navy-soft: #2A5F8F;
  --amber: #C48A2A;
  --amber-bg: #FBF5EA;
  --amber-border: #E8D4A8;
  --danger: #B33A3A;
  --success: #2F6B4F;
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --border: #E2E6EB;
  --border-strong: #C9D0D8;
  --text: #1A2330;
  --text-muted: #5C6B7A;
  --text-faint: #8A97A5;
  --shadow: 0 1px 2px rgba(26, 35, 48, 0.06), 0 4px 16px rgba(26, 35, 48, 0.04);
  --shadow-md: 0 2px 8px rgba(26, 35, 48, 0.08), 0 8px 24px rgba(26, 35, 48, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --kb-inset: 0px;
  --tap-min: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
html.is-touch button,
html.is-touch .nav-item,
html.is-touch .btn {
  -webkit-tap-highlight-color: transparent;
}
html.is-touch .btn,
html.is-touch .nav-item,
html.is-touch .party-member,
html.is-touch .party-convo,
html.is-touch .party-subnav-btn,
html.is-touch .bell-btn,
html.is-touch .menu-btn {
  min-height: var(--tap-min);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ——— Login ——— */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #163A5C 0%, #1F4E79 45%, #2A5F8F 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-brand .mark {
  width: 40px; height: 40px;
  background: var(--navy);
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
}
.login-brand .mark-logo {
  background: transparent;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.login-brand .mark-logo img {
  width: 40px; height: 40px;
  display: block;
  object-fit: cover;
  border-radius: 10px;
}
.login-card h1 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.login-card .subtitle {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 14px;
}
.login-card label {
  display: block;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  background: #fff;
}
.login-card input:focus {
  outline: 2px solid rgba(31, 78, 121, 0.25);
  border-color: var(--navy);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 560;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-dark); }
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-amber {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #7A5514;
}
.btn-danger {
  background: #F8EDED;
  border-color: #E8C4C4;
  color: var(--danger);
}
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ——— App shell ——— */
.app {
  display: none;
  min-height: 100vh;
}
.app.visible { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar {
  background: var(--sidebar-bg, var(--navy));
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header .mark {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar-header .mark-logo {
  background: #fff;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  text-decoration: none;
}
.sidebar-header .mark-logo img {
  width: 32px; height: 32px;
  display: block;
  object-fit: cover;
  border-radius: 8px;
}
.sidebar-header .mark-logo:hover {
  opacity: 0.92;
}
.sidebar-header h1 {
  font-size: 16px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}
.sidebar-header .tagline {
  font-size: 11.5px;
  opacity: 0.65;
  margin: 6px 0 0 42px;
}

.nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}
.nav-section {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.5;
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.82);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px;
}
.sidebar-footer .user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: grid; place-items: center;
  font-weight: 650;
  font-size: 12px;
}
.sidebar-footer .user-meta { line-height: 1.25; }
.sidebar-footer .user-meta strong { display: block; font-size: 13px; }
.sidebar-footer .user-meta span { opacity: 0.65; font-size: 11.5px; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.breadcrumb {
  color: var(--text-faint);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb button {
  color: var(--navy);
  font-weight: 500;
}
.breadcrumb button:hover { text-decoration: underline; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bell-wrap { position: relative; }
.bell-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
  position: relative;
}
.bell-btn:hover { background: var(--bg); color: var(--text); }
.bell-btn svg { width: 20px; height: 20px; }
.bell-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.bell-dot.show { display: block; }

.notif-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  max-height: 420px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.notif-panel.open { display: block; }
.notif-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 620;
  font-size: 13.5px;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--amber-bg); }
.notif-item .n-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.notif-item .n-body { color: var(--text-muted); font-size: 12.5px; }
.notif-item .n-meta { color: var(--text-faint); font-size: 11.5px; margin-top: 4px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); }

.content {
  padding: 24px;
  flex: 1;
}

/* ——— Cards & layout ——— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat {
  padding: 16px 18px;
}
.stat .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 550;
  margin-bottom: 4px;
}
.stat .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--navy);
}
.stat .hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.stat.attention .value { color: var(--amber); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-open { background: #EEF4FA; color: var(--navy); border-color: #C5D8EA; }
.badge-progress { background: var(--amber-bg); color: #7A5514; border-color: var(--amber-border); }
.badge-resolved, .badge-done { background: #EAF4EE; color: var(--success); border-color: #C5DFD0; }
.badge-high { background: #F8EDED; color: var(--danger); border-color: #E8C4C4; }
.badge-medium { background: var(--amber-bg); color: #7A5514; border-color: var(--amber-border); }
.badge-low { background: var(--bg); color: var(--text-muted); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 12px;
  font-weight: 580;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(31, 78, 121, 0.2);
  border-color: var(--navy);
}
.field textarea { min-height: 80px; resize: vertical; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FAFBFC; }
table.data .actions { white-space: nowrap; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ——— Calendar ——— */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cal-nav h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  min-width: 180px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-dow {
  background: #FAFBFC;
  padding: 10px 8px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cal-day {
  background: var(--surface);
  min-height: 92px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.cal-day:hover { background: #F7F9FB; }
.cal-day.other { background: #Fafbfc; color: var(--text-faint); }
.cal-day.today .day-num {
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: grid; place-items: center;
}
.cal-day .day-num {
  font-weight: 620;
  font-size: 13px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
}
.cal-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
  padding-top: 4px;
}
.cal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--navy-soft);
}
.cal-dot.ea { background: var(--amber); }
.cal-dot.note { background: var(--success); }
.cal-event-chip {
  font-size: 10.5px;
  line-height: 1.2;
  padding: 2px 5px;
  border-radius: 3px;
  background: #EEF4FA;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cal-event-chip.ea { background: var(--amber-bg); color: #7A5514; }

/* ——— Day page ——— */
.day-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.day-header h2 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.day-header .day-sub { color: var(--text-muted); font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 0 4px;
}
.tab {
  padding: 10px 14px;
  font-weight: 560;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  font-weight: 650;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tl-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tl-item:last-child { border-bottom: none; }
.tl-time {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  padding-top: 2px;
}
.tl-body strong { display: block; font-size: 14px; margin-bottom: 2px; }
.tl-meta { color: var(--text-muted); font-size: 12.5px; }
.tl-meta span + span::before { content: " · "; color: var(--text-faint); }

/* Rich notes */
.editor-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
}
.editor-toolbar button {
  width: 32px; height: 32px;
  border-radius: 5px;
  display: grid; place-items: center;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
}
.editor-toolbar button:hover { background: var(--border); color: var(--text); }
.editor-toolbar .sep {
  width: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.editor {
  min-height: 280px;
  padding: 18px 20px;
  outline: none;
  font-size: 15px;
  line-height: 1.65;
}
.editor:focus { box-shadow: inset 0 0 0 2px rgba(31, 78, 121, 0.12); }
.editor h2 { font-size: 18px; margin: 0.6em 0 0.35em; }
.editor h3 { font-size: 15.5px; margin: 0.55em 0 0.3em; }
.editor ul, .editor ol { padding-left: 1.35em; margin: 0.4em 0; }
.editor p { margin: 0.4em 0; }

/* Photo gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.photo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
}
.photo-card.size-small { max-width: 140px; }
.photo-card.size-medium { }
.photo-card.size-large { grid-column: span 2; }
.photo-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--bg);
  cursor: grab;
}
.photo-card.dragging { opacity: 0.5; }
.photo-meta { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.photo-meta input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 12.5px;
}
.photo-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.photo-actions select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  background: #FAFBFC;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--navy);
  background: #EEF4FA;
  color: var(--navy);
}
.upload-zone input { display: none; }

/* Ideas / activity */
.idea-list, .activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.idea-item, .activity-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.idea-item .who, .activity-item .who {
  font-weight: 620;
  font-size: 13px;
}
.idea-item .when, .activity-item .when {
  color: var(--text-faint);
  font-size: 11.5px;
  margin-left: 6px;
}
.idea-item .text, .activity-item .text {
  margin-top: 4px;
  font-size: 13.5px;
}

/* Weekly report EA style */
.report-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 860px;
  margin: 0 auto;
}
.report-sheet .sheet-head {
  background: var(--navy);
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.report-sheet .sheet-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 650;
}
.report-sheet .sheet-head p { margin: 0; opacity: 0.8; font-size: 13.5px; }
.report-section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.report-section:last-child { border-bottom: none; }
.report-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}
.report-section.needs h3 { color: #7A5514; }
.report-section ul {
  margin: 0;
  padding-left: 1.2em;
}
.report-section li { margin-bottom: 6px; }
.report-section textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  resize: vertical;
}
.report-list-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-list-edit .row {
  display: flex;
  gap: 6px;
}
.report-list-edit input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Week schedule */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.week-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 200px;
  overflow: hidden;
}
.week-col-head {
  padding: 8px 10px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
  font-weight: 650;
  font-size: 12.5px;
}
.week-col-head .dow { color: var(--text-muted); font-weight: 550; font-size: 11px; }
.week-col-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.week-event {
  padding: 6px 8px;
  border-radius: 5px;
  background: #EEF4FA;
  font-size: 12px;
  cursor: pointer;
  border-left: 3px solid var(--navy);
}
.week-event.ea { background: var(--amber-bg); border-left-color: var(--amber); }
.week-event .t { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); }
.week-event .title { font-weight: 600; margin-top: 2px; }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 48, 0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-md);
}
.modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  font-size: 13.5px;
}
.toast.show { opacity: 1; transform: translateY(0); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app.visible { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s;
    width: var(--sidebar-w);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 72px; }
  .photo-card.size-large { grid-column: span 1; }
}
.menu-btn {
  display: none;
  width: 36px; height: 36px;
  place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
}
.menu-btn:hover { background: var(--bg); }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 55;
}
.sidebar-backdrop.open { display: block; }

@media print {
  .sidebar, .topbar, .btn, .editor-toolbar, .upload-zone, .nav { display: none !important; }
  .app.visible { display: block; }
  .content { padding: 0; }
  .report-sheet { box-shadow: none; border: none; }
}


/* ——— Vendors browser (file-manager style) ——— */
.app.vendors-focus .content {
  padding: 12px 16px 20px;
}
.app.vendors-focus .topbar {
  height: 48px;
  padding: 0 16px;
}
.app.vendors-focus .topbar h2 {
  font-size: 15px;
}

.vendors-browser {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - var(--topbar-h) - 40px);
}

.vendors-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.vendors-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}
.vendors-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.vendors-search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}
.vendors-search-wrap input:focus {
  outline: 2px solid rgba(31, 78, 121, 0.2);
  border-color: var(--navy);
}

.vendors-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 580;
  color: var(--text-muted);
}
.inline-label select {
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 500;
  color: var(--text);
}

.vendors-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
}
.chip:hover { border-color: var(--navy-soft); color: var(--navy); }
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.chip-count {
  font-size: 11px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.chip.active .chip-count { opacity: 0.9; }

.vendors-meta {
  font-size: 12.5px;
  color: var(--text-faint);
}

.vendors-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.vendor-empty { padding: 48px 20px; }

.vendor-list-head {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1.4fr) minmax(160px, 1fr) minmax(140px, 1.2fr) 64px;
  gap: 10px;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.vendor-row {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1.4fr) minmax(160px, 1fr) minmax(140px, 1.2fr) 64px;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: #fff;
}
.vendor-row:hover { background: #F7F9FB; }
.vendor-row.compact { padding: 7px 14px; }
.vendor-row:last-child { border-bottom: none; }

.vendor-row-icon, .folder-ico, .vendor-folder-mark {
  color: var(--navy);
  display: grid;
  place-items: center;
}
.v-icon { width: 20px; height: 20px; }

.vendor-row-title {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.vendor-row.compact .vendor-row-title { font-size: 13.5px; }
.vendor-row-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.vendor-row-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  min-width: 0;
}
.vendor-row-contact a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vendor-row-notes {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.vendor-row.compact .vendor-row-notes { -webkit-line-clamp: 1; }

.vendor-folders { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.vendor-folder {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.vendor-folder-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13.5px;
  color: var(--text);
}
.vendor-folder-head:hover { background: #F0F4F8; }
.vendor-folder.collapsed .vendor-folder-head { border-bottom: none; }
.vendor-folder.collapsed .vendor-folder-body { display: none; }
.vendor-folder-head .chev {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  display: grid;
  place-items: center;
}
.vendor-folder-head .chev svg { width: 14px; height: 14px; }
.folder-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.vendor-folder-body .vendor-row { border-radius: 0; }

.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}
.vendor-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.vendor-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.vendor-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.vendor-folder-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #EEF4FA;
}
.vendor-card-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.015em;
}
.vendor-card-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.vendor-card-contact {
  font-size: 13px;
  margin-top: 4px;
}
.vendor-card-contact .muted { color: var(--text-muted); font-size: 12.5px; }
.vendor-card-notes {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 900px) {
  .vendor-list-head { display: none; }
  .vendor-row, .vendor-row.compact {
    grid-template-columns: 36px 1fr auto;
    grid-template-areas:
      "icon main edit"
      "icon contact edit"
      "icon notes edit";
  }
  .vendor-row-icon { grid-area: icon; }
  .vendor-row-main { grid-area: main; }
  .vendor-row-contact { grid-area: contact; }
  .vendor-row-notes { grid-area: notes; }
  .vendor-row .edit-vendor { grid-area: edit; }
}

/* ——— Day page polish ——— */
.app.day-focus .content { padding: 0 0 32px; }
.app.day-focus .topbar { display: none; }

.day-page { max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; }
.day-sticky-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 4px 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  margin: 0 -4px 16px;
}
.day-sticky-left { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.day-sticky-titles h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.day-kicker {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 2px;
}
.day-sticky-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.day-cover {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  max-height: 220px;
}
.day-cover img { width: 100%; height: 220px; object-fit: cover; display: block; }
.day-cover-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: #fff;
  font-size: 13px;
}

.day-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
.day-aside { position: sticky; top: 88px; }
.day-tabs-card .tabs { padding: 0 12px; margin-bottom: 0; }
.day-tab-body { min-height: 320px; }
.card-hint { font-size: 12px; color: var(--text-muted); }

.editor-lg .editor {
  min-height: 360px;
  font-size: 15.5px;
  line-height: 1.7;
  padding: 22px 24px;
}
.editor-toolbar {
  gap: 4px;
  padding: 10px 12px;
}
.editor-toolbar button {
  min-width: 34px;
  height: 34px;
  border-radius: 6px;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 12px;
}
.editor-hint { font-size: 12.5px; color: var(--text-faint); }
.editor[data-placeholder]:empty::before,
.editor[data-placeholder]:has(> p:only-child:empty)::before,
.editor[data-placeholder]:has(> br:only-child)::before,
.editor[data-placeholder]:has(> p:only-child > br:only-child)::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--navy) 10%, var(--surface));
  color: var(--navy);
  display: grid; place-items: center;
}
.empty-state-icon svg { width: 22px; height: 22px; }
.empty-state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty-state p { margin: 0 0 14px; font-size: 13.5px; max-width: 320px; margin-left: auto; margin-right: auto; }

.conflict-banner {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: #7A5514;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 550;
}

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  display: grid;
  grid-template-columns: 16px 64px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tl-item:last-child { border-bottom: none; }
.tl-item.conflict { background: color-mix(in srgb, var(--amber) 8%, transparent); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--navy); flex-shrink: 0; }
.tl-item.ea .tl-dot { background: var(--amber); }
.tl-item.conflict .tl-dot { background: var(--danger); }
.tl-line { width: 2px; flex: 1; background: var(--border); margin-top: 4px; min-height: 12px; }
.tl-item:last-child .tl-line { display: none; }
.tl-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
.tl-start { display: block; font-weight: 600; color: var(--text); }
.tl-end { opacity: 0.75; }
.tl-title-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 2px; }
.tl-actions { margin-top: 6px; display: flex; gap: 4px; opacity: 0.7; }
.tl-item:hover .tl-actions { opacity: 1; }

.photo-card { position: relative; }
.photo-card.is-cover { outline: 2px solid var(--navy); outline-offset: 1px; }
.cover-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--navy); color: #fff;
  font-size: 10.5px; font-weight: 650;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.photo-thumb {
  display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in;
}
.photo-thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; pointer-events: none; }
.upload-zone { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.upload-zone span { font-size: 13px; }

.idea-panel { display: flex; flex-direction: column; gap: 14px; }
.idea-head { display: flex; align-items: center; gap: 6px; }
.idea-head .del-idea { margin-left: auto; }
.card-inset {
  background: color-mix(in srgb, var(--bg) 80%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* Lightbox */
.lightbox[hidden] { display: none !important; }
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10, 16, 24, 0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
body.lightbox-open { overflow: hidden; }
.lightbox-figure { margin: 0; max-width: min(960px, 92vw); text-align: center; }
.lightbox-figure img {
  max-width: 100%; max-height: 78vh;
  border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.lightbox-figure figcaption { color: rgba(255,255,255,0.85); margin-top: 12px; font-size: 14px; }
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 28px; width: 40px; height: 40px;
  border-radius: 8px;
}
.lightbox-close:hover { background: rgba(255,255,255,0.12); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #fff; font-size: 42px; width: 48px; height: 64px;
  border-radius: 8px; line-height: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.1); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

@media (max-width: 960px) {
  .day-layout { grid-template-columns: 1fr; }
  .day-aside { position: static; }
}

@media print {
  .day-sticky-actions, .upload-zone, .photo-actions, .tl-actions,
  .editor-toolbar, .sidebar, .bell-wrap, .menu-btn, #lightbox { display: none !important; }
  .app.day-focus .topbar { display: none !important; }
  .day-sticky-header { position: static; background: none; border: none; }
  .day-page { max-width: none; padding: 0; }
  .day-layout { grid-template-columns: 1fr; }
  .editor { min-height: auto !important; }
}

/* ——— Calendar depth ——— */
.cal-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.cal-view-toggle button {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.cal-view-toggle button:last-child { border-right: none; }
.cal-view-toggle button.active {
  background: var(--navy);
  color: #fff;
}
.cal-anim {
  animation: calFade 0.22s ease;
}
@keyframes calFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: var(--text-muted);
  margin-top: 12px;
  align-items: center;
}
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-dot.incident { background: var(--danger); }
.cal-dot.maint { background: var(--amber); }
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.cal-year-month {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--surface);
}
.cal-year-month h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--navy);
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-mini-dow {
  text-align: center;
  font-size: 9px;
  color: var(--text-faint);
  font-weight: 650;
}
.cal-mini-day {
  aspect-ratio: 1;
  border-radius: 4px;
  font-size: 11px;
  display: grid; place-items: center;
  color: var(--text);
  position: relative;
}
.cal-mini-day.other { color: var(--text-faint); opacity: 0.45; }
.cal-mini-day.has-ev { background: color-mix(in srgb, var(--navy) 12%, transparent); font-weight: 650; }
.cal-mini-day.today { outline: 2px solid var(--navy); }
.cal-mini-day:hover { background: color-mix(in srgb, var(--navy) 18%, transparent); }
.cal-quick-add {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--navy);
  font-size: 14px;
  line-height: 1;
  display: none;
  place-items: center;
  z-index: 2;
}
.cal-day:hover .cal-quick-add { display: grid; }
.recent-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.recent-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-muted);
}
.recent-chip:hover { border-color: var(--navy); color: var(--navy); }

/* ——— Global search & theme UI ——— */
.topbar-search-wrap {
  position: relative;
  width: min(320px, 36vw);
}
.topbar-search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13.5px;
}
.topbar-search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-faint); pointer-events: none;
}
.search-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  min-width: 360px;
  max-height: 420px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 60;
}
.search-panel.open { display: block; }
.search-hit {
  display: block; width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.search-hit:hover { background: var(--bg); }
.search-hit .kind {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--navy); margin-bottom: 2px;
}
.search-hit .title { font-weight: 600; font-size: 13.5px; }
.search-hit .snip { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

.theme-panel {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 60;
  padding: 14px;
}
.theme-panel.open { display: block; }
.theme-panel h4 { margin: 0 0 10px; font-size: 13.5px; }
.theme-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.theme-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--navy); }
.theme-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.theme-custom-grid label {
  font-size: 11.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px;
}
.theme-custom-grid input[type="color"] {
  width: 100%; height: 32px; border: 1px solid var(--border); border-radius: 4px; padding: 2px; background: var(--surface);
}

html[data-theme="dark"] .login-screen {
  background: linear-gradient(160deg, #0a121c 0%, #132338 50%, #1a3050 100%);
}
html[data-theme="dark"] .sidebar {
  background: var(--navy-dark);
}
html[data-theme="dark"] .cal-day.other { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
html[data-theme="dark"] .card, html[data-theme="dark"] .vendor-card,
html[data-theme="dark"] .week-col, html[data-theme="dark"] .photo-card {
  background: var(--surface);
}

/* ——— Schedules polish ——— */
.sched-page { display: flex; flex-direction: column; gap: 14px; }
.sched-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.sched-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sched-range { display: flex; flex-direction: column; min-width: 140px; line-height: 1.25; }
.sched-range strong { font-size: 15px; letter-spacing: -0.02em; }
.sched-range .muted, .muted { color: var(--text-muted); font-size: 12px; }
.sched-actions-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sched-stats { margin: 0; }
.sched-board { padding: 12px; overflow: auto; }
.sched-board .week-grid { margin: 0; }
.week-col.is-today { border-color: var(--navy); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--navy) 35%, transparent); }
.week-col-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  background: color-mix(in srgb, var(--bg) 85%, var(--surface));
}
.week-col-date {
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.week-col-date:hover { color: var(--navy); text-decoration: underline; }
.week-col.density-compact .week-col-body { gap: 4px; padding: 6px; }
.week-col.density-compact { min-height: 160px; }

.sched-event {
  padding: 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--navy) 8%, var(--surface));
  border-left: 3px solid var(--navy);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.sched-event.ea {
  background: var(--amber-bg);
  border-left-color: var(--amber);
}
.sched-event.conflict {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent);
}
.sched-event:hover { filter: brightness(0.98); }
.sched-event-top {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 2px;
}
.sched-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.sched-title { font-weight: 650; font-size: 12.5px; line-height: 1.3; }
.sched-meta { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.sched-actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.sched-event:hover .sched-actions { opacity: 1; }
.week-col.density-compact .sched-meta,
.week-col.density-compact .sched-actions { display: none; }
.week-col.density-compact .sched-event { padding: 5px 6px; }

.sched-day-empty {
  font-size: 12px;
  color: var(--text-faint);
  padding: 8px 4px;
  text-align: center;
}
.sched-maint-chip {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: #7A5514;
  font-weight: 550;
}
.export-pre {
  margin: 0;
  font-size: 12px;
  white-space: pre-wrap;
  font-family: var(--mono);
  color: var(--text-muted);
  max-height: 180px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ——— EA weekly report polish ——— */
.report-page { display: flex; flex-direction: column; gap: 14px; }
.report-sheet {
  background: var(--surface);
  max-width: 880px;
}
.sheet-head-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 8px;
}
.sheet-kicker {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 4px;
}
.sheet-meta label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  opacity: 0.9;
}
.sheet-meta input[type="date"] {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  color-scheme: dark;
}
.report-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.report-section-head h3 { margin: 0; }
.report-count {
  font-size: 11.5px;
  font-weight: 650;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--text-muted);
}
.report-section.needs .report-count {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #7A5514;
}
.report-blurb {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.report-bullet {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--navy);
  flex-shrink: 0;
  margin-top: 12px;
}
.report-section.needs .report-bullet { background: var(--amber); }
.report-list-edit .row { align-items: flex-start; }
.report-list-edit input {
  padding: 8px 10px;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.report-empty-hint {
  font-size: 13px;
  color: var(--text-faint);
  padding: 8px 0 4px;
  font-style: italic;
}
.report-footer {
  padding: 12px 24px 18px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}
.report-section textarea {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  min-height: 88px;
  font-size: 14px;
  line-height: 1.55;
}

@media print {
  body.print-schedules .sidebar,
  body.print-schedules .topbar,
  body.print-schedules .no-print,
  body.print-schedules .sched-toolbar,
  body.print-schedules .sched-stats,
  body.print-schedules .sched-export-card { display: none !important; }
  body.print-schedules .app.visible { display: block; }
  body.print-schedules .content { padding: 0; }
  body.print-schedules .week-grid { grid-template-columns: repeat(7, 1fr) !important; gap: 6px; }
  body.print-schedules .sched-actions { display: none !important; }

  body.print-report .sidebar,
  body.print-report .topbar,
  body.print-report .no-print,
  body.print-report .sched-toolbar,
  body.print-report .sched-stats { display: none !important; }
  body.print-report .app.visible { display: block; }
  body.print-report .content { padding: 0; }
  body.print-report .report-sheet {
    box-shadow: none;
    border: none;
    max-width: none;
  }
  body.print-report .report-list-edit .rem-line,
  body.print-report .report-list-edit .add-line { display: none !important; }
  body.print-report .report-list-edit input {
    border: none;
    padding: 2px 0;
    background: transparent;
  }
  body.print-report .report-bullet { margin-top: 8px; }
}

/* ——— Incidents / Solutions / Maintenance ——— */
.ops-page { display: flex; flex-direction: column; gap: 14px; }
.ops-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ops-search { flex: 1; min-width: 200px; max-width: 360px; }
.ops-split {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.2fr);
  min-height: 420px;
  overflow: hidden;
  padding: 0;
}
.ops-list {
  border-right: 1px solid var(--border);
  overflow: auto;
  max-height: min(70vh, 640px);
}
.ops-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-left: 3px solid transparent;
}
.ops-row:hover { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
.ops-row.selected {
  background: color-mix(in srgb, var(--navy) 8%, var(--surface));
  border-left-color: var(--navy);
}
.ops-row.sev-high { border-left-color: var(--danger); }
.ops-row.sev-high.selected { border-left-color: var(--danger); }
.ops-row-title { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.ops-row-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.ops-detail-pane { overflow: auto; max-height: min(70vh, 640px); }
.ops-detail { padding: 18px 20px; }
.ops-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.ops-detail-head h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.ops-kicker {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 4px;
}
.ops-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.ops-detail-body h4 {
  margin: 16px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ops-detail-body p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ops-muted { color: var(--text-faint); font-size: 13px; }
.ops-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ops-link-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
}
.linkish {
  color: var(--navy);
  font-weight: 600;
  font-size: 13.5px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.linkish:hover { text-decoration: underline; }

.sol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.sol-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sol-card.highlight {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}
.sol-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sol-card-title {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.015em;
}
.sol-card-notes {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sol-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.maint-list { padding: 0; overflow: hidden; }
.maint-row {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.maint-row:last-child { border-bottom: none; }
.maint-row.overdue {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  border-left: 3px solid var(--danger);
}
.maint-row.due-today {
  background: var(--amber-bg);
  border-left: 3px solid var(--amber);
}
.maint-title { font-weight: 650; font-size: 14.5px; }
.maint-notes {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.maint-due { text-align: right; }
.maint-due-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.maint-row.overdue .maint-due-label { color: var(--danger); }
.maint-row.due-today .maint-due-label { color: #7A5514; }
.maint-due-date {
  font-size: 15px;
  font-weight: 650;
  margin-top: 2px;
}
.maint-actions { display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 900px) {
  .ops-split { grid-template-columns: 1fr; }
  .ops-list { max-height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
  .maint-row { grid-template-columns: 1fr; gap: 8px; }
  .maint-due { text-align: left; }
  .maint-actions { flex-direction: row; }
}

/* Auth panels */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.auth-tab {
  padding: 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow);
}
.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: #F8EDED;
  border: 1px solid #E8C4C4;
  color: var(--danger);
  border-radius: 6px;
  font-size: 13px;
}
.verify-dev {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}
.verify-dev a { color: var(--navy); font-weight: 600; }


/* ——— Party ——— */
.party-shell { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.party-subnav {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.party-subnav-btn {
  flex: 1; min-width: 96px; padding: 10px 14px; border-radius: 9px;
  font-weight: 600; font-size: 13.5px; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.party-subnav-btn:hover { background: var(--bg); color: var(--text); }
.party-subnav-btn.active {
  background: var(--navy); color: #fff;
}
.party-subnav-badge {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--amber); color: #fff; font-size: 11px; font-weight: 700;
}
.party-subnav-btn.active .party-subnav-badge { background: #fff; color: var(--navy); }
.party-body { min-width: 0; }
.party-section-label {
  margin: 18px 0 8px; font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.party-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}
.party-messages-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  align-items: stretch;
  min-height: min(70vh, 620px);
}
.party-messages-layout.thread-focus { grid-template-columns: 1fr; }
.party-roster, .party-convo-pane { padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: min(72vh, 680px); }
.party-roster .card-header, .party-convo-pane .card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.party-roster-list, .party-convo-list { overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.party-member, .party-convo {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 12px 16px; border: 0; background: transparent; text-align: left;
  cursor: pointer; color: inherit; border-bottom: 1px solid var(--border);
}
.party-member:hover, .party-convo:hover { background: var(--bg); }
.party-member.active, .party-convo.active { background: var(--amber-bg); }
.party-meta { min-width: 0; flex: 1; }
.party-meta strong { display: block; font-size: 13.5px; }
.party-meta span { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-you { font-weight: 500; color: var(--text-faint); }
.party-convo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.party-convo-side time { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.party-convo-pill {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.party-av {
  width: 42px; height: 42px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 650; flex-shrink: 0;
  position: relative; overflow: visible;
}
.party-av.lg { width: 64px; height: 64px; font-size: 20px; }
.party-av.has-img { overflow: hidden; }
.party-av.has-img img, .avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.avatar.has-img { padding: 0; overflow: hidden; }
.party-av.has-img { overflow: visible; }
.party-av.has-img img { overflow: hidden; }
.party-dot {
  position: absolute; right: 1px; bottom: 1px; width: 10px; height: 10px;
  border-radius: 50%; background: #9AA3AF; border: 2px solid var(--surface, #fff);
  z-index: 1;
}
.party-dot.on { background: #22C55E; }
.party-unread-badge {
  position: absolute; top: -4px; right: -4px; z-index: 2;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #E11D48; color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center; border: 2px solid var(--surface, #fff);
  line-height: 1;
}
.party-unread-badge[hidden] { display: none !important; }
.party-profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.party-profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.party-notif-block { margin-top: 8px; }
.party-notif-list { display: flex; flex-direction: column; gap: 6px; }
.party-notif {
  text-align: left; border: 1px solid var(--border); background: var(--surface, #fff);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; color: inherit;
}
.party-notif.unread { background: var(--amber-bg); }
.party-chat-card {
  display: flex; flex-direction: column; min-height: min(70vh, 620px); height: 100%;
  padding: 0; overflow: hidden;
}
.party-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.party-chat-head-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.party-chat-thread {
  flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); -webkit-overflow-scrolling: touch;
}
.party-bubble {
  max-width: min(78%, 420px); align-self: flex-start; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 12px 12px 12px 4px; padding: 8px 11px;
}
.party-bubble.mine {
  align-self: flex-end; background: var(--navy); color: #fff; border-color: transparent;
  border-radius: 12px 12px 4px 12px;
}
.party-bubble-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.party-bubble-meta { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.party-chat-compose {
  display: flex; gap: 8px; padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom) + var(--kb-inset));
  border-top: 1px solid var(--border); background: var(--surface);
}
.party-chat-compose input { flex: 1; min-width: 0; min-height: 42px; border-radius: 10px; border: 1px solid var(--border); padding: 8px 12px; background: var(--bg); }
.party-empty-detail .empty-state { padding: 12px 4px 8px; }
.party-empty-detail .empty-state strong { display: block; font-size: 16px; margin-bottom: 6px; }
.party-empty-detail .empty-state p { margin: 0; color: var(--text-muted); }

/* Live DM toast (original Estate Ops style) */
.party-live-toast {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom) + var(--kb-inset));
  z-index: 220;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(340px, calc(100vw - 32px));
}
.party-live-toast.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.party-live-toast-btn {
  width: 100%; text-align: left; padding: 12px 14px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(145deg, #163A5C, #1F4E79);
  color: #fff; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 2px;
}
.party-live-toast-btn strong { font-size: 13.5px; }
.party-live-toast-btn span { font-size: 12.5px; opacity: 0.88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-item { position: relative; }
.nav-unread-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #E11D48; color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.nav-unread-badge[hidden] { display: none !important; }

.bell-dot.has-count::after {
  content: attr(data-count);
  position: absolute; top: -6px; right: -8px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #E11D48; color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 1px solid var(--surface);
}

/* ——— Mobile / tablet overall ——— */
@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app.visible { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s;
    width: min(var(--sidebar-w), 86vw);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid !important; }
  .main { min-width: 0; max-width: 100vw; }
  .topbar {
    position: sticky; top: 0; z-index: 40;
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
    padding-top: max(8px, var(--safe-top));
  }
  .topbar-search-wrap { max-width: 100%; flex: 1; min-width: 0; }
  .topbar-search-wrap input { font-size: 16px; } /* prevent iOS zoom */
  .content { padding: 12px; padding-bottom: calc(20px + var(--safe-bottom)); max-width: 100%; overflow-x: hidden; }
  .card, .party-shell, .party-messages-layout, .party-layout { max-width: 100%; }
  .party-messages-layout { grid-template-columns: 1fr; min-height: 0; }
  .party-convo-pane, .party-roster { max-height: none; }
  .party-chat-card { min-height: calc(100dvh - 180px); }
  .party-bubble { max-width: 88%; }
  .login-screen { padding: 16px; padding-top: calc(16px + var(--safe-top)); }
  .login-card { padding: 28px 20px; }
  .modal { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
  .notif-panel {
    right: 8px; left: auto; width: min(360px, calc(100vw - 16px));
    max-height: min(70vh, 480px);
  }
  .week-grid, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar-right { gap: 4px; }
  input, select, textarea { font-size: 16px; } /* iOS zoom guard */
}
@media (max-width: 600px) {
  .topbar-search-wrap { display: none; } /* room for actions; search still in menu flows via dedicated later if needed */
  #view-title { font-size: 16px; }
  .party-subnav-btn { min-width: 0; padding: 10px 8px; font-size: 13px; }
  .stat .value { font-size: 22px; }
}
@media (max-width: 800px) {
  .party-layout { grid-template-columns: 1fr; }
}
html.is-mobile .content > * { max-width: 100%; }
html.is-mobile table { display: block; overflow-x: auto; max-width: 100%; }
