/* MiddleWise - app styles (Bootstrap 5.3 base)
   Warm paper neutrals, ink text, one pine accent. Parent colours appear only as tints. */

/* ---------- Tokens ---------- */
:root,
[data-bs-theme=light] {
  --mw-bg: #f6f4ef;
  --mw-surface: #ffffff;
  --mw-surface-2: #f1eee7;
  --mw-surface-3: #e8e4da;
  --mw-border: #e4dfd4;
  --mw-border-strong: #d2ccbf;
  --mw-ink: #1d1c1a;
  --mw-ink-2: #5a564e;
  --mw-ink-3: #8a857c;
  --mw-accent: #22574b;
  --mw-accent-hover: #1a463c;
  --mw-accent-ink: #ffffff;
  --mw-accent-soft: #e3ece8;
  --mw-accent-text: #1f5246;
  --mw-focus: rgba(34, 87, 75, .22);
  --mw-success: #3d7a4a;
  --mw-danger: #b4432f;
  --mw-warning: #a46c16;
  --mw-info: #38668f;
  --mw-sand: #f5efe2;
  --mw-sand-border: #e5d9bf;
  --mw-shadow: 0 1px 2px rgba(29, 28, 26, .05);
  --mw-shadow-lg: 0 16px 40px -16px rgba(29, 28, 26, .22), 0 2px 6px rgba(29, 28, 26, .06);

  --bs-body-bg: var(--mw-bg);
  --bs-body-bg-rgb: 246, 244, 239;
  --bs-body-color: var(--mw-ink);
  --bs-body-color-rgb: 29, 28, 26;
  --bs-emphasis-color: var(--mw-ink);
  --bs-emphasis-color-rgb: 29, 28, 26;
  --bs-heading-color: var(--mw-ink);
  --bs-secondary-color: var(--mw-ink-2);
  --bs-secondary-color-rgb: 90, 86, 78;
  --bs-tertiary-color: var(--mw-ink-3);
  --bs-secondary-bg: var(--mw-surface-2);
  --bs-tertiary-bg: var(--mw-surface-2);
  --bs-border-color: var(--mw-border);
  --bs-border-color-translucent: var(--mw-border);
  --bs-primary: var(--mw-accent);
  --bs-primary-rgb: 34, 87, 75;
  --bs-success-rgb: 61, 122, 74;
  --bs-danger-rgb: 180, 67, 47;
  --bs-warning-rgb: 196, 138, 47;
  --bs-info-rgb: 56, 102, 143;
  --bs-link-color: var(--mw-accent-text);
  --bs-link-color-rgb: 31, 82, 70;
  --bs-link-hover-color: var(--mw-accent-hover);
  --bs-link-hover-color-rgb: 26, 70, 60;
  --bs-focus-ring-color: var(--mw-focus);
}
[data-bs-theme=dark] {
  --mw-bg: #151513;
  --mw-surface: #1d1c1a;
  --mw-surface-2: #262522;
  --mw-surface-3: #312f2b;
  --mw-border: #33312d;
  --mw-border-strong: #46433c;
  --mw-ink: #ece9e2;
  --mw-ink-2: #b4afa5;
  --mw-ink-3: #878278;
  --mw-accent: #7fb6a4;
  --mw-accent-hover: #98c6b6;
  --mw-accent-ink: #0f1f1b;
  --mw-accent-soft: rgba(127, 182, 164, .14);
  --mw-accent-text: #8fc2b1;
  --mw-focus: rgba(127, 182, 164, .3);
  --mw-success: #7fb98a;
  --mw-danger: #e08a76;
  --mw-warning: #dcae63;
  --mw-info: #8db4d6;
  --mw-sand: rgba(214, 190, 140, .08);
  --mw-sand-border: rgba(214, 190, 140, .22);
  --mw-shadow: none;
  --mw-shadow-lg: 0 18px 44px -14px rgba(0, 0, 0, .65);

  --bs-body-bg: var(--mw-bg);
  --bs-body-bg-rgb: 21, 21, 19;
  --bs-body-color: var(--mw-ink);
  --bs-body-color-rgb: 236, 233, 226;
  --bs-emphasis-color: var(--mw-ink);
  --bs-emphasis-color-rgb: 236, 233, 226;
  --bs-heading-color: var(--mw-ink);
  --bs-secondary-color: var(--mw-ink-2);
  --bs-secondary-color-rgb: 180, 175, 165;
  --bs-tertiary-color: var(--mw-ink-3);
  --bs-secondary-bg: var(--mw-surface-2);
  --bs-tertiary-bg: var(--mw-surface-2);
  --bs-border-color: var(--mw-border);
  --bs-border-color-translucent: var(--mw-border);
  --bs-primary: var(--mw-accent);
  --bs-primary-rgb: 127, 182, 164;
  --bs-link-color: var(--mw-accent-text);
  --bs-link-color-rgb: 143, 194, 177;
  --bs-link-hover-color: var(--mw-accent-hover);
  --bs-link-hover-color-rgb: 152, 198, 182;
}
:root {
  --mw-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mw-sans: 'Public Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mw-radius: 14px;
  --mw-radius-sm: 10px;
  --mw-sidebar-w: 252px;
  --mw-topbar-h: 56px;
  --mw-tabbar-h: 62px;
  --bs-body-font-family: var(--mw-sans);
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.55;
  --bs-border-radius: var(--mw-radius-sm);
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: var(--mw-radius);
}

/* ---------- Base ---------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--mw-accent) 22%, transparent); }
h1, h2, h3, .h1, .h2, .h3, h1.h4, h1.h5, .serif { font-family: var(--mw-serif); font-weight: 600; letter-spacing: -.012em; }
h4, h5, h6, .h4, .h5, .h6 { font-family: var(--mw-sans); font-weight: 600; letter-spacing: -.005em; }
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 { font-family: var(--mw-serif); font-weight: 600; letter-spacing: -.02em; }
.fw-bold { font-weight: 650 !important; }
a { text-underline-offset: .18em; text-decoration-thickness: 1px; text-decoration: none; }
a:hover { text-decoration: underline; }
p a, li a, .alert a, .form-text a, .pre-line a, td a { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item:hover, .brand:hover, .card:hover, .mobile-tabbar a:hover,
.setup-step:hover, .stat-card:hover, .account-btn:hover, .fc a:hover, .topbar-title a:hover, .back-link:hover { text-decoration: none; }
hr { border-color: var(--mw-border); opacity: 1; }
.small, small { font-size: .84rem; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
.pre-line { white-space: pre-line; }
.text-primary { color: var(--mw-accent-text) !important; }
.text-success { color: var(--mw-success) !important; }
.text-danger { color: var(--mw-danger) !important; }
.text-warning { color: var(--mw-warning) !important; }
.text-info { color: var(--mw-info) !important; }
.bg-body { background-color: var(--mw-surface) !important; }
.border-warning { border-color: color-mix(in srgb, var(--mw-warning) 45%, var(--mw-border)) !important; }
.border-primary { border-color: color-mix(in srgb, var(--mw-accent) 45%, var(--mw-border)) !important; }
:focus-visible { outline: 2px solid var(--mw-accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-padding-y: .5rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: .9rem;
  --bs-btn-border-radius: var(--mw-radius-sm);
  --bs-btn-focus-box-shadow: 0 0 0 .2rem var(--mw-focus);
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn-sm { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; --bs-btn-border-radius: 8px; }
.btn-lg { --bs-btn-padding-y: .72rem; --bs-btn-padding-x: 1.35rem; --bs-btn-font-size: 1rem; --bs-btn-border-radius: 12px; }
.btn-primary {
  --bs-btn-color: var(--mw-accent-ink); --bs-btn-bg: var(--mw-accent); --bs-btn-border-color: var(--mw-accent);
  --bs-btn-hover-color: var(--mw-accent-ink); --bs-btn-hover-bg: var(--mw-accent-hover); --bs-btn-hover-border-color: var(--mw-accent-hover);
  --bs-btn-active-color: var(--mw-accent-ink); --bs-btn-active-bg: var(--mw-accent-hover); --bs-btn-active-border-color: var(--mw-accent-hover);
  --bs-btn-disabled-color: var(--mw-accent-ink); --bs-btn-disabled-bg: var(--mw-accent); --bs-btn-disabled-border-color: var(--mw-accent);
}
.btn-light, .btn-outline-secondary, .btn-secondary {
  --bs-btn-color: var(--mw-ink); --bs-btn-bg: var(--mw-surface); --bs-btn-border-color: var(--mw-border-strong);
  --bs-btn-hover-color: var(--mw-ink); --bs-btn-hover-bg: var(--mw-surface-2); --bs-btn-hover-border-color: var(--mw-border-strong);
  --bs-btn-active-color: var(--mw-ink); --bs-btn-active-bg: var(--mw-surface-3); --bs-btn-active-border-color: var(--mw-border-strong);
  --bs-btn-disabled-color: var(--mw-ink-3); --bs-btn-disabled-bg: var(--mw-surface); --bs-btn-disabled-border-color: var(--mw-border);
  box-shadow: var(--mw-shadow);
}
.btn-outline-primary {
  --bs-btn-color: var(--mw-accent-text); --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--mw-accent) 40%, var(--mw-border));
  --bs-btn-hover-color: var(--mw-accent-text); --bs-btn-hover-bg: var(--mw-accent-soft); --bs-btn-hover-border-color: var(--mw-accent);
  --bs-btn-active-color: var(--mw-accent-text); --bs-btn-active-bg: var(--mw-accent-soft); --bs-btn-active-border-color: var(--mw-accent);
}
.btn-success {
  --bs-btn-color: #fff; --bs-btn-bg: #3d7a4a; --bs-btn-border-color: #3d7a4a;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #33673e; --bs-btn-hover-border-color: #33673e;
  --bs-btn-active-bg: #2c5935; --bs-btn-active-border-color: #2c5935;
}
.btn-danger {
  --bs-btn-color: #fff; --bs-btn-bg: #b4432f; --bs-btn-border-color: #b4432f;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #9a3826; --bs-btn-hover-border-color: #9a3826;
  --bs-btn-active-bg: #87301f; --bs-btn-active-border-color: #87301f;
}
.btn-outline-danger {
  --bs-btn-color: var(--mw-danger); --bs-btn-border-color: color-mix(in srgb, var(--mw-danger) 40%, var(--mw-border));
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #b4432f; --bs-btn-hover-border-color: #b4432f;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #9a3826; --bs-btn-active-border-color: #9a3826;
}
.btn-outline-success {
  --bs-btn-color: var(--mw-success); --bs-btn-border-color: color-mix(in srgb, var(--mw-success) 40%, var(--mw-border));
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #3d7a4a; --bs-btn-hover-border-color: #3d7a4a;
}
.btn-warning {
  --bs-btn-color: #2a1d06; --bs-btn-bg: #e2b45f; --bs-btn-border-color: #e2b45f;
  --bs-btn-hover-color: #2a1d06; --bs-btn-hover-bg: #d6a54d; --bs-btn-hover-border-color: #d6a54d;
}
.btn-link { --bs-btn-color: var(--mw-accent-text); --bs-btn-hover-color: var(--mw-accent-hover); text-decoration: none; }
.btn-close:focus { box-shadow: 0 0 0 .2rem var(--mw-focus); }
.btn-icon {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; position: relative;
  border-radius: 10px; padding: 0; border: 0; background: transparent; color: var(--mw-ink-2); font-size: 1.12rem;
}
.btn-icon:hover, .btn-icon:focus-visible { background: var(--mw-surface-2); color: var(--mw-ink); }
.count-badge {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--mw-danger); color: #fff; font-size: .625rem; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--mw-bg);
}

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .35rem; color: var(--mw-ink); }
.form-text { color: var(--mw-ink-3); font-size: .8rem; }
.form-control, .form-select {
  min-height: 42px; color: var(--mw-ink); background-color: var(--mw-surface);
  border-color: var(--mw-border-strong); border-radius: var(--mw-radius-sm); font-size: .9375rem;
}
.form-control::placeholder { color: var(--mw-ink-3); opacity: 1; }
.form-control:focus, .form-select:focus { color: var(--mw-ink); background-color: var(--mw-surface); border-color: var(--mw-accent); box-shadow: 0 0 0 .2rem var(--mw-focus); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--mw-surface-2); }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: .8125rem; border-radius: 8px; }
textarea.form-control { min-height: 96px; }
.form-check-input { border-color: var(--mw-border-strong); background-color: var(--mw-surface); }
.form-check-input:focus { border-color: var(--mw-accent); box-shadow: 0 0 0 .2rem var(--mw-focus); }
.form-check-input:checked { background-color: var(--mw-accent); border-color: var(--mw-accent); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%238a857c'/%3e%3c/svg%3e"); }
[data-bs-theme=dark] .form-switch .form-check-input:checked { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230f1f1b'/%3e%3c/svg%3e"); }
.input-group-text { background: var(--mw-surface-2); border-color: var(--mw-border-strong); color: var(--mw-ink-2); }
.invalid-feedback { color: var(--mw-danger); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--mw-danger); }

/* ---------- Surfaces ---------- */
.card {
  --bs-card-bg: var(--mw-surface); --bs-card-border-color: var(--mw-border); --bs-card-border-radius: var(--mw-radius);
  --bs-card-inner-border-radius: calc(var(--mw-radius) - 1px); --bs-card-cap-bg: transparent;
  --bs-card-spacer-x: 1.25rem; --bs-card-spacer-y: 1.15rem; --bs-card-cap-padding-x: 1.25rem; --bs-card-cap-padding-y: .85rem;
  box-shadow: var(--mw-shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 52px;
  font-weight: 600; font-size: .9375rem; border-bottom-color: var(--mw-border);
}
.card-header .bi { color: var(--mw-ink-3); }
.card-footer { background: transparent; border-top-color: var(--mw-border); }
.card-title-sm { font-size: .8125rem; font-weight: 600; color: var(--mw-ink-2); margin-bottom: .6rem; }
.list-group {
  --bs-list-group-bg: transparent; --bs-list-group-color: var(--mw-ink); --bs-list-group-border-color: var(--mw-border);
  --bs-list-group-item-padding-x: 1.25rem; --bs-list-group-item-padding-y: .85rem;
  --bs-list-group-action-color: var(--mw-ink); --bs-list-group-action-hover-color: var(--mw-ink);
  --bs-list-group-action-hover-bg: var(--mw-surface-2); --bs-list-group-action-active-color: var(--mw-ink);
  --bs-list-group-action-active-bg: var(--mw-surface-3);
  --bs-list-group-active-bg: var(--mw-accent-soft); --bs-list-group-active-border-color: var(--mw-border); --bs-list-group-active-color: var(--mw-accent-text);
}
.list-group-item .bi-chevron-right { color: var(--mw-ink-3); font-size: .85rem; }
.table {
  --bs-table-bg: transparent; --bs-table-color: var(--mw-ink); --bs-table-border-color: var(--mw-border);
  --bs-table-hover-bg: var(--mw-surface-2); --bs-table-hover-color: var(--mw-ink); --bs-table-striped-bg: var(--mw-surface-2);
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: .8rem .75rem; background-color: transparent; }
.table thead th {
  font-size: .72rem; font-weight: 600; color: var(--mw-ink-3); text-transform: uppercase; letter-spacing: .05em;
  padding-top: .75rem; padding-bottom: .6rem; white-space: nowrap; border-bottom-color: var(--mw-border);
}
.table > :not(:first-child) { border-top: 0; }
.card .table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.card .table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.table tbody tr:last-child > * { border-bottom: 0; }
.dropdown-menu {
  --bs-dropdown-bg: var(--mw-surface); --bs-dropdown-color: var(--mw-ink); --bs-dropdown-border-color: var(--mw-border);
  --bs-dropdown-border-radius: 12px; --bs-dropdown-padding-x: .3rem; --bs-dropdown-padding-y: .3rem; --bs-dropdown-font-size: .9rem;
  --bs-dropdown-link-color: var(--mw-ink); --bs-dropdown-link-hover-color: var(--mw-ink); --bs-dropdown-link-hover-bg: var(--mw-surface-2);
  --bs-dropdown-link-active-color: var(--mw-accent-text); --bs-dropdown-link-active-bg: var(--mw-accent-soft);
  --bs-dropdown-item-padding-x: .75rem; --bs-dropdown-item-padding-y: .45rem; --bs-dropdown-divider-bg: var(--mw-border);
  --bs-dropdown-header-color: var(--mw-ink-3);
  box-shadow: var(--mw-shadow-lg);
}
.dropdown-menu.shadow { box-shadow: var(--mw-shadow-lg) !important; }
.dropdown-item { border-radius: 8px; }
.dropdown-item .bi { color: var(--mw-ink-3); width: 1.25rem; display: inline-block; }
.dropdown-item.active .bi { color: inherit; }
.modal {
  --bs-modal-bg: var(--mw-surface); --bs-modal-border-color: var(--mw-border); --bs-modal-border-radius: 16px;
  --bs-modal-inner-border-radius: 15px; --bs-modal-header-border-color: var(--mw-border); --bs-modal-footer-border-color: var(--mw-border);
  --bs-modal-padding: 1.25rem; --bs-modal-header-padding: 1rem 1.25rem;
}
.modal-title { font-family: var(--mw-serif); font-weight: 600; font-size: 1.25rem; }
.modal-backdrop { --bs-backdrop-bg: #1d1c1a; --bs-backdrop-opacity: .4; }
.offcanvas { --bs-offcanvas-bg: var(--mw-bg); --bs-offcanvas-border-color: var(--mw-border); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--mw-ink); --bs-nav-pills-link-active-color: var(--mw-surface); --bs-nav-pills-border-radius: 8px; --bs-nav-link-color: var(--mw-ink-2); --bs-nav-link-hover-color: var(--mw-ink); --bs-nav-link-font-weight: 500; }
.nav-tabs { --bs-nav-tabs-border-color: var(--mw-border); --bs-nav-tabs-link-active-bg: var(--mw-surface); --bs-nav-tabs-link-active-border-color: var(--mw-border) var(--mw-border) var(--mw-surface); --bs-nav-link-color: var(--mw-ink-2); --bs-nav-link-hover-color: var(--mw-ink); }
.progress { --bs-progress-bg: var(--mw-surface-2); --bs-progress-border-radius: 999px; --bs-progress-bar-bg: var(--mw-accent); }
.progress-bar + .progress-bar { box-shadow: inset 2px 0 0 var(--mw-surface); }
.pagination { --bs-pagination-color: var(--mw-ink); --bs-pagination-bg: var(--mw-surface); --bs-pagination-border-color: var(--mw-border); --bs-pagination-hover-bg: var(--mw-surface-2); --bs-pagination-active-bg: var(--mw-ink); --bs-pagination-active-border-color: var(--mw-ink); --bs-pagination-active-color: var(--mw-surface); }
.vr { background-color: var(--mw-border-strong); opacity: 1; }

/* ---------- Feedback ---------- */
.alert { --bs-alert-padding-y: .8rem; --bs-alert-padding-x: 1rem; --bs-alert-border-radius: var(--mw-radius-sm); font-size: .9rem; }
.alert-info { --bs-alert-color: #24465f; --bs-alert-bg: #e8eff4; --bs-alert-border-color: #d0dfe9; --bs-alert-link-color: #1b3a50; }
.alert-success { --bs-alert-color: #24502d; --bs-alert-bg: #e7f0e7; --bs-alert-border-color: #cde1cf; --bs-alert-link-color: #1c4024; }
.alert-warning { --bs-alert-color: #69460f; --bs-alert-bg: #f8efdc; --bs-alert-border-color: #ecdab3; --bs-alert-link-color: #55380b; }
.alert-danger { --bs-alert-color: #7b2b1d; --bs-alert-bg: #f8e6e1; --bs-alert-border-color: #edcbc2; --bs-alert-link-color: #63210f; }
.alert-light, .alert-secondary { --bs-alert-color: var(--mw-ink-2); --bs-alert-bg: var(--mw-surface-2); --bs-alert-border-color: var(--mw-border); --bs-alert-link-color: var(--mw-ink); }
[data-bs-theme=dark] .alert-info { --bs-alert-color: #b9d2e6; --bs-alert-bg: rgba(110, 160, 205, .1); --bs-alert-border-color: rgba(110, 160, 205, .24); --bs-alert-link-color: #d5e5f2; }
[data-bs-theme=dark] .alert-success { --bs-alert-color: #b6d8bc; --bs-alert-bg: rgba(110, 180, 125, .1); --bs-alert-border-color: rgba(110, 180, 125, .24); --bs-alert-link-color: #d3eadb; }
[data-bs-theme=dark] .alert-warning { --bs-alert-color: #e8cd96; --bs-alert-bg: rgba(220, 174, 99, .1); --bs-alert-border-color: rgba(220, 174, 99, .26); --bs-alert-link-color: #f3e0b8; }
[data-bs-theme=dark] .alert-danger { --bs-alert-color: #efb7a8; --bs-alert-bg: rgba(224, 138, 118, .1); --bs-alert-border-color: rgba(224, 138, 118, .26); --bs-alert-link-color: #f6d2c8; }
.alert .bi { flex-shrink: 0; }
.flash-stack { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.flash-stack .alert { margin: 0; box-shadow: none !important; }
.toast-stack {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem;
  width: min(380px, calc(100vw - 2rem));
}
.toast-stack .alert { margin: 0; box-shadow: var(--mw-shadow-lg); }
@media (max-width: 991.98px) { .toast-stack { right: 1rem; bottom: calc(var(--mw-tabbar-h) + 1rem + env(safe-area-inset-bottom)); } }

.badge { font-weight: 600; letter-spacing: .01em; }
.badge.rounded-pill { padding: .32em .7em; }
.text-bg-danger { background-color: var(--mw-danger) !important; color: #fff !important; }
.text-bg-warning { background-color: #e2b45f !important; color: #2a1d06 !important; }
.text-bg-light { background-color: var(--mw-surface-2) !important; color: var(--mw-ink-2) !important; }
.text-bg-secondary { background-color: var(--mw-surface-3) !important; color: var(--mw-ink-2) !important; }
.text-bg-primary { background-color: var(--mw-accent) !important; color: var(--mw-accent-ink) !important; }
.text-bg-success { background-color: var(--mw-success) !important; color: #fff !important; }
.badge-soft-warning { background: #f6e9cc; color: #6f4a0e; }
.badge-soft-success { background: #e0ede1; color: #2b5a34; }
.badge-soft-danger { background: #f5e0da; color: #84301f; }
.badge-soft-primary { background: var(--mw-accent-soft); color: var(--mw-accent-text); }
.badge-soft-secondary { background: var(--mw-surface-2); color: var(--mw-ink-2); }
.badge-soft-info { background: #e3ecf4; color: #2d5576; }
[data-bs-theme=dark] .badge-soft-warning { background: rgba(220, 174, 99, .16); color: #e8c27e; }
[data-bs-theme=dark] .badge-soft-success { background: rgba(127, 185, 138, .16); color: #9fcca8; }
[data-bs-theme=dark] .badge-soft-danger { background: rgba(224, 138, 118, .16); color: #eba493; }
[data-bs-theme=dark] .badge-soft-info { background: rgba(141, 180, 214, .16); color: #a9c8e3; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-sidebar { width: var(--mw-sidebar-w); flex-shrink: 0; background: var(--mw-bg); border-right: 1px solid var(--mw-border); }
@media (min-width: 992px) { .app-sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; } }
@media (max-width: 991.98px) { .app-sidebar.offcanvas-lg { --bs-offcanvas-width: 292px; } }
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; padding: 1rem .75rem .75rem; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .1rem .85rem .45rem; }

.brand {
  display: inline-flex; align-items: center; gap: .55rem; color: var(--mw-ink); text-decoration: none;
  font-family: var(--mw-serif); font-weight: 600; font-size: 1.22rem; letter-spacing: -.015em; line-height: 1;
}
.brand:hover { color: var(--mw-ink); }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; color: currentColor; }
.brand-mark .lens { fill: var(--mw-accent); }

.family-switcher > .btn {
  width: 100%; display: flex; align-items: center; gap: .65rem; text-align: left; padding: .5rem .6rem;
  background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: 12px; box-shadow: var(--mw-shadow);
}
.family-switcher > .btn:hover, .family-switcher > .btn.show { border-color: var(--mw-border-strong); background: var(--mw-surface); }
.family-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--mw-accent-soft); color: var(--mw-accent-text); font-family: var(--mw-serif); font-weight: 600; font-size: 1rem;
}
.family-switcher .label { display: block; font-size: .72rem; color: var(--mw-ink-3); line-height: 1.2; }
.family-switcher .name { display: block; font-weight: 600; font-size: .9rem; line-height: 1.25; color: var(--mw-ink); }

.app-nav { margin-top: .9rem; display: flex; flex-direction: column; gap: 1px; }
.app-nav .nav-link {
  display: flex; align-items: center; gap: .7rem; padding: .44rem .6rem; border-radius: 9px;
  color: var(--mw-ink-2); font-weight: 500; font-size: .9rem;
}
.app-nav .nav-link .bi { font-size: 1.02rem; width: 1.15rem; text-align: center; color: var(--mw-ink-3); transition: color .12s; }
.app-nav .nav-link:hover { background: var(--mw-surface-2); color: var(--mw-ink); }
.app-nav .nav-link.active { background: var(--mw-surface); color: var(--mw-ink); font-weight: 600; box-shadow: 0 0 0 1px var(--mw-border), var(--mw-shadow); }
.app-nav .nav-link.active .bi { color: var(--mw-accent); }
.nav-count {
  margin-left: auto; min-width: 1.3rem; height: 1.3rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; background: var(--mw-accent); color: var(--mw-accent-ink);
}
.nav-section { font-size: .72rem; font-weight: 600; letter-spacing: .02em; color: var(--mw-ink-3); padding: 1.15rem .6rem .35rem; }

.sidebar-account { margin-top: auto; padding-top: 1rem; }
.account-btn {
  width: 100%; display: flex; align-items: center; gap: .65rem; padding: .5rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--mw-ink); text-align: left;
}
.account-btn:hover, .account-btn.show { background: var(--mw-surface-2); }
.account-btn .who { min-width: 0; flex: 1; line-height: 1.25; }
.account-btn .who strong { display: block; font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-btn .who small { display: block; font-size: .75rem; color: var(--mw-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--mw-topbar-h); display: flex; align-items: center; gap: .25rem; padding: 0 .5rem;
  background: color-mix(in srgb, var(--mw-bg) 88%, transparent); -webkit-backdrop-filter: saturate(1.3) blur(12px); backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--mw-border);
}
.topbar-title { min-width: 0; flex: 1; font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title a { color: inherit; text-decoration: none; }
.app-content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 2.25rem 2.5rem 3.5rem; }
.app-content-wide { max-width: 1440px; }
@media (max-width: 1199.98px) { .app-content { padding: 2rem 1.75rem 3rem; } }
@media (max-width: 991.98px) { .app-content { padding: 1.25rem 1rem calc(var(--mw-tabbar-h) + 1.75rem + env(safe-area-inset-bottom)); } }

.mobile-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex;
  height: calc(var(--mw-tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--mw-surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--mw-border);
}
.mobile-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative;
  color: var(--mw-ink-3); text-decoration: none; font-size: .6875rem; font-weight: 500;
}
.mobile-tabbar a .bi { font-size: 1.25rem; }
.mobile-tabbar a.active { color: var(--mw-accent-text); font-weight: 600; }
.tab-dot { position: absolute; top: 9px; left: calc(50% + 7px); width: 8px; height: 8px; border-radius: 50%; background: var(--mw-danger); box-shadow: 0 0 0 2px var(--mw-surface); }

/* ---------- Page furniture ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .9rem 1.25rem; margin-bottom: 1.75rem; }
.page-title { font-family: var(--mw-serif); font-weight: 600; font-size: 2rem; line-height: 1.12; letter-spacing: -.02em; margin: 0; }
.page-subtitle { color: var(--mw-ink-2); margin: .4rem 0 0; font-size: .9375rem; max-width: 62ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.eyebrow { font-size: .8125rem; font-weight: 500; color: var(--mw-ink-3); margin-bottom: .3rem; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; color: var(--mw-ink-2); text-decoration: none; margin-bottom: .75rem; }
.back-link:hover { color: var(--mw-ink); }
@media (max-width: 575.98px) {
  .page-title { font-size: 1.6rem; }
  .page-header { margin-bottom: 1.25rem; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1 1 auto; }
  .page-actions > .dropdown > .btn { width: 100%; }
}

.stat-label { font-size: .8125rem; font-weight: 500; color: var(--mw-ink-2); }
.stat-value { font-size: 1.65rem; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; font-variant-numeric: tabular-nums; margin-top: .2rem; color: var(--mw-ink); }
.stat-card { color: var(--mw-ink); transition: border-color .12s; }
.stat-card:hover { border-color: var(--mw-border-strong); color: var(--mw-ink); }
.kv dt { font-size: .8rem; font-weight: 500; color: var(--mw-ink-3); }
.kv dd { margin-bottom: .85rem; }
.filter-pills .btn { border-radius: 999px; }
.icon-tile {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--mw-surface-2); color: var(--mw-ink-2); font-size: 1rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: .75rem; letter-spacing: .02em; background: var(--mw-ink-3);
}
.avatar-sm { width: 28px; height: 28px; font-size: .66rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.mediator-avatar { background: var(--mw-accent); color: var(--mw-accent-ink); }
.mediator-avatar .brand-mark { width: 70%; height: 70%; color: var(--mw-accent-ink); }
.mediator-avatar .brand-mark .lens { fill: var(--mw-accent-ink); }
.child-photo { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.child-photo-lg { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; }
.child-initial {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--mw-sand); border: 1px solid var(--mw-sand-border); color: var(--mw-ink-2);
  font-family: var(--mw-serif); font-weight: 600; font-size: 1.3rem;
}
.empty-state { text-align: center; padding: 2.5rem 1.25rem; }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto .9rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--mw-surface-2); color: var(--mw-ink-3); font-size: 1.25rem;
}
.empty-state h3 { font-family: var(--mw-sans); font-size: .975rem; font-weight: 600; letter-spacing: 0; }
.empty-state p { max-width: 44ch; margin-left: auto; margin-right: auto; }

/* ---------- Dashboard ---------- */
.today-card .card-body { padding: 1.5rem; }
.today-name { font-family: var(--mw-serif); font-weight: 600; font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; display: flex; align-items: center; gap: .6rem; }
.today-name .swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.today-meta { color: var(--mw-ink-2); font-size: .9rem; }
.setup-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 767.98px) { .setup-steps { grid-template-columns: 1fr; } }
.setup-step {
  display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border-radius: 10px; text-decoration: none;
  background: var(--mw-surface); border: 1px solid var(--mw-border); color: var(--mw-ink); font-weight: 500; font-size: .9rem;
}
.setup-step:hover { border-color: var(--mw-border-strong); color: var(--mw-ink); }
.setup-step .bi { font-size: 1.1rem; color: var(--mw-ink-3); }
.setup-step.done { color: var(--mw-ink-3); text-decoration: line-through; text-decoration-color: var(--mw-border-strong); }
.setup-step.done .bi { color: var(--mw-success); }
.date-tile { width: 44px; text-align: center; flex-shrink: 0; line-height: 1.1; }
.date-tile .m { font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mw-ink-3); }
.date-tile .d { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Parenting-time views (each cell sets --pc to the parent's colour) ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; font-size: .8125rem; color: var(--mw-ink-2); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: -.02em; }
.legend-changed { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--mw-ink-2); margin-right: .4rem; vertical-align: .1em; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
.week-day {
  position: relative; border-radius: 10px; padding: .55rem .2rem .5rem; text-align: center; min-width: 0;
  background: color-mix(in srgb, var(--pc, transparent) 12%, var(--mw-surface));
  border: 1px solid color-mix(in srgb, var(--pc, var(--mw-border)) 26%, var(--mw-surface));
}
.week-day .wd { font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mw-ink-3); }
.week-day .dn { font-size: 1.15rem; font-weight: 600; line-height: 1.35; font-variant-numeric: tabular-nums; }
.week-day .who { font-size: .72rem; font-weight: 600; color: color-mix(in srgb, var(--pc, var(--mw-ink-3)) 78%, var(--mw-ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .2rem; }
.week-day.today { border-color: var(--mw-ink); box-shadow: inset 0 0 0 1px var(--mw-ink); }
.week-day.none { background: var(--mw-surface-2); border-color: var(--mw-border); }
.week-day.override::after, .month-cell.override::after { content: ''; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--mw-ink-2); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-grid .dow { text-align: center; font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mw-ink-3); padding-bottom: .4rem; }
.month-cell {
  position: relative; min-height: 64px; border-radius: 8px; padding: .35rem .45rem; font-size: .75rem; min-width: 0;
  background: color-mix(in srgb, var(--pc, transparent) 13%, var(--mw-surface)); color: var(--mw-ink);
  box-shadow: inset 0 3px 0 var(--pc, var(--mw-border));
}
.month-cell .num { font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 2px; }
.month-cell .who { font-weight: 500; color: color-mix(in srgb, var(--pc, var(--mw-ink-3)) 78%, var(--mw-ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-cell.none { background: var(--mw-surface-2); box-shadow: none; }
.month-cell.other-month { opacity: .42; }
.month-cell.today { box-shadow: inset 0 3px 0 var(--pc, var(--mw-border)), inset 0 0 0 2px var(--mw-ink); }
.month-cell[data-idx] { cursor: default; }
.month-grid.editable .month-cell[data-idx] { cursor: pointer; }
.month-grid.editable .month-cell[data-idx]:hover { filter: brightness(.97); }
@media (max-width: 575.98px) { .month-cell { min-height: 46px; padding: .3rem .35rem; } .month-cell .who { display: none; } }
.pattern-bar { display: flex; gap: 3px; max-width: 420px; }
.pattern-bar span { flex: 1; height: 14px; border-radius: 3px; background: color-mix(in srgb, var(--pc) 70%, var(--mw-surface)); }

/* ---------- Calendar (FullCalendar) ---------- */
.fc {
  --fc-border-color: var(--mw-border); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--mw-surface-2);
  --fc-today-bg-color: transparent; --fc-list-event-hover-bg-color: var(--mw-surface-2); --fc-now-indicator-color: var(--mw-danger);
  --fc-button-text-color: var(--mw-ink); --fc-button-bg-color: var(--mw-surface); --fc-button-border-color: var(--mw-border-strong);
  --fc-button-hover-bg-color: var(--mw-surface-2); --fc-button-hover-border-color: var(--mw-border-strong);
  --fc-button-active-bg-color: var(--mw-ink); --fc-button-active-border-color: var(--mw-ink);
  --fc-event-border-color: transparent; --fc-small-font-size: .75rem;
  font-size: .8125rem;
}
.fc a { text-decoration: none; color: inherit; }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 1rem; }
.fc .fc-toolbar-title { font-family: var(--mw-serif); font-weight: 600; font-size: 1.4rem; letter-spacing: -.015em; }
.fc .fc-button { font-weight: 500; font-size: .8125rem; padding: .38rem .75rem; box-shadow: none !important; text-transform: none; }
.fc .fc-button .fc-icon { font-size: 1.1em; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: var(--mw-surface); }
.fc .fc-button-primary:disabled { opacity: .5; color: var(--mw-ink-2); }
.fc .fc-col-header-cell-cushion { padding: .55rem 0; font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mw-ink-3); }
.fc .fc-daygrid-day-number { padding: .4rem .5rem; font-size: .8rem; color: var(--mw-ink-2); font-variant-numeric: tabular-nums; }
.fc .fc-day-today .fc-daygrid-day-number {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.65rem; height: 1.65rem; margin: .2rem .25rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--mw-ink); color: var(--mw-surface); font-weight: 600;
}
.fc .fc-day-other .fc-daygrid-day-top { opacity: .45; }
.fc .fc-bg-event.custody-bg { opacity: .14; }
.fc .fc-bg-event .fc-event-title { display: none; }
.fc .fc-daygrid-dot-event { align-items: flex-start; }
.fc .fc-daygrid-dot-event .fc-daygrid-event-dot { margin-top: .38em; }
.fc .fc-daygrid-dot-event .fc-event-time { flex-shrink: 0; }
.fc .fc-daygrid-dot-event .fc-event-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.fc .fc-daygrid-event { border-radius: 6px; margin-top: 2px; font-size: .75rem; }
.fc .fc-daygrid-dot-event { padding: 1px 4px; }
.fc .fc-daygrid-dot-event:hover { background: var(--mw-surface-2); }
.fc .fc-daygrid-dot-event .fc-event-title { font-weight: 500; }
.fc .fc-daygrid-event-dot { border-width: 4px; }
.fc .fc-daygrid-block-event { padding: 1px 5px; }
.fc .fc-daygrid-block-event .fc-event-main, .fc .fc-timegrid-event .fc-event-main { font-weight: 500; }
.fc .fc-daygrid-more-link { font-size: .72rem; color: var(--mw-ink-2); font-weight: 500; }
.fc .fc-list { border-radius: 10px; overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--mw-surface-2); }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { font-weight: 600; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { font-size: .72rem; color: var(--mw-ink-3); }
.fc-event { cursor: pointer; }
.fc .fc-popover { background: var(--mw-surface); border-color: var(--mw-border); border-radius: 12px; box-shadow: var(--mw-shadow-lg); overflow: hidden; }
.fc .fc-popover-header { background: var(--mw-surface-2); }
@media (max-width: 575.98px) {
  .fc .fc-toolbar { flex-wrap: wrap; gap: .5rem; }
  .fc .fc-toolbar-title { font-size: 1.15rem; }
}

/* ---------- Chat & mediation ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 5.75rem); height: calc(100dvh - 5.75rem); min-height: 440px; }
@media (max-width: 991.98px) { .chat-wrap { height: calc(100dvh - var(--mw-topbar-h) - var(--mw-tabbar-h) - 2.5rem - env(safe-area-inset-bottom)); } }
.chat-log { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .3rem; }
.chat-day { align-self: center; margin: .9rem 0 .35rem; padding: .15rem .65rem; border-radius: 999px; background: var(--mw-surface-2); color: var(--mw-ink-3); font-size: .72rem; font-weight: 600; }
.bubble-row { display: flex; gap: .5rem; align-items: flex-end; max-width: min(78%, 640px); }
.bubble-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: .6rem .9rem; border-radius: 16px; background: var(--mw-surface-2); color: var(--mw-ink); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-row.mine .bubble { background: var(--mw-accent); color: var(--mw-accent-ink); border-bottom-right-radius: 6px; }
.bubble-row:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.bubble-meta { font-size: .68rem; color: var(--mw-ink-3); margin: 0 .35rem; white-space: nowrap; }
.bubble img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; margin-top: .35rem; }
.bubble a.att { color: inherit; text-decoration: underline; }
.bubble-row.mediator { max-width: min(90%, 720px); }
.bubble-row.mediator .bubble { background: var(--mw-sand); border: 1px solid var(--mw-sand-border); color: var(--mw-ink); white-space: normal; }
.bubble-row.mediator .bubble p:last-child, .bubble-row.mediator .bubble ul:last-child, .bubble-row.mediator .bubble ol:last-child { margin-bottom: 0; }
.chat-composer { border-top: 1px solid var(--mw-border); padding: .75rem; display: flex; gap: .5rem; align-items: flex-end; }
.chat-composer textarea { resize: none; min-height: 44px; max-height: 160px; border-radius: 12px; }
.chat-composer .btn-primary { border-radius: 12px; }
.typing { font-size: .8rem; color: var(--mw-ink-3); padding: 0 1.25rem .6rem; }
.typing .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 1px; animation: blink 1.4s infinite both; }
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---------- Photos & lists ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.photo-grid a { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--mw-surface-2); position: relative; }
.photo-grid img, .photo-grid video { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.photo-grid a:hover img { transform: scale(1.03); }
.photo-grid .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.list-item-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .25rem; border-bottom: 1px solid var(--mw-border); }
.list-item-row:last-child { border-bottom: 0; }
.list-item-row.done .item-text { text-decoration: line-through; color: var(--mw-ink-3); }
.list-item-row .btn-del { opacity: 0; }
.list-item-row:hover .btn-del, .list-item-row .btn-del:focus { opacity: .7; }
@media (hover: none) { .list-item-row .btn-del { opacity: .6; } }

/* ---------- Sign-in pages ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.auth-aside {
  display: none; position: relative; overflow: hidden; padding: 2.5rem 3rem; flex-direction: column; justify-content: space-between;
  background: #1f4a40; color: #e4ede9;
}
@media (min-width: 992px) { .auth-aside { display: flex; } }
.auth-aside .brand, .auth-aside .brand:hover { color: #fff; }
.auth-aside .brand-mark .lens { fill: #a9d3c4; }
.auth-aside h2 { font-size: 2.6rem; line-height: 1.08; color: #fff; letter-spacing: -.025em; max-width: 13ch; }
.auth-aside p { color: #c6d8d1; max-width: 42ch; }
.auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; }
.auth-points li { display: flex; gap: .65rem; align-items: baseline; margin-bottom: .7rem; color: #dce8e3; font-size: .925rem; }
.auth-points .bi { color: #a9d3c4; }
.auth-aside .motif { position: absolute; right: -210px; bottom: -150px; width: 520px; height: 520px; color: rgba(255, 255, 255, .07); pointer-events: none; }
.auth-aside .motif .lens { fill: rgba(169, 211, 196, .08); }
.auth-aside small { color: #9fbcb1; position: relative; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 2rem; letter-spacing: -.02em; }

/* ---------- Landing ---------- */
.landing-nav { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 0; }
.landing-nav .links a { color: var(--mw-ink-2); text-decoration: none; font-weight: 500; font-size: .925rem; }
.landing-nav .links a:hover { color: var(--mw-ink); }
.hero { padding: 3.5rem 0 4.5rem; }
.hero h1 { font-size: clamp(2.6rem, 3.6vw + 1.2rem, 4.4rem); line-height: 1.02; letter-spacing: -.03em; }
.hero h1 em { font-style: italic; color: var(--mw-accent-text); }
.hero .lede { font-size: 1.18rem; line-height: 1.55; color: var(--mw-ink-2); max-width: 34rem; }
.hero-note { font-size: .875rem; color: var(--mw-ink-3); }
.hero-note .bi { color: var(--mw-accent); }
.vignette { position: relative; max-width: 470px; margin-left: auto; }
.vignette .card { box-shadow: var(--mw-shadow-lg); }
.vignette .float { position: relative; margin: -1.75rem -1rem 0 2.5rem; }
@media (max-width: 991.98px) { .vignette { margin: 0 auto; } .vignette .float { margin: -1.25rem 0 0 1.5rem; } }
.section { padding: 4.5rem 0; }
.section-alt { background: var(--mw-surface); border-top: 1px solid var(--mw-border); border-bottom: 1px solid var(--mw-border); }
.section-title { font-size: clamp(1.9rem, 1.5vw + 1.3rem, 2.6rem); letter-spacing: -.025em; line-height: 1.1; }
.section-lede { color: var(--mw-ink-2); font-size: 1.06rem; max-width: 40rem; }
.pillar h3 { font-size: 1.35rem; }
.pillar .kicker { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mw-accent-text); }
.feature-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.feature-list li { padding: .85rem 0; border-top: 1px solid var(--mw-border); }
.feature-list li strong { display: block; font-weight: 600; margin-bottom: .15rem; }
.feature-list li span { color: var(--mw-ink-2); font-size: .925rem; }
.name-note { font-family: var(--mw-serif); font-size: clamp(1.4rem, 1vw + 1.1rem, 1.85rem); line-height: 1.35; letter-spacing: -.01em; max-width: 34ch; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 1.4rem 2.75rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -.1rem; width: 1.85rem; height: 1.85rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
  background: var(--mw-accent-soft); color: var(--mw-accent-text);
}
.steps li strong { display: block; }
.steps li span { color: var(--mw-ink-2); font-size: .95rem; }
.cta-band { background: #1f4a40; color: #e4ede9; border-radius: 20px; padding: 3rem; position: relative; overflow: hidden; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #c6d8d1; }
.cta-band .btn-light { --bs-btn-bg: #fff; --bs-btn-color: #1f4a40; --bs-btn-border-color: #fff; --bs-btn-hover-bg: #eef3f0; --bs-btn-hover-border-color: #eef3f0; --bs-btn-hover-color: #1f4a40; font-weight: 600; }
@media (max-width: 575.98px) { .cta-band { padding: 2rem 1.5rem; } }
.site-footer { color: var(--mw-ink-3); font-size: .85rem; padding: 2rem 0 2.5rem; }

/* ---------- Print (reports) ---------- */
@media print {
  .app-sidebar, .app-topbar, .mobile-tabbar, .no-print, .flash-stack, .toast-stack { display: none !important; }
  .app-content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
.list-group-item.active { font-weight: 600; }

/* ---------- Clickable days, handover (split) days, day popup ---------- */
button.month-cell, button.week-day {
  display: block; width: 100%; font: inherit; text-align: inherit; cursor: pointer; border-width: 0;
  transition: filter .12s, transform .12s;
}
button.week-day { text-align: center; border-width: 1px; border-style: solid; color: var(--mw-ink); }
button.month-cell { text-align: left; }
button.month-cell span, button.week-day span { display: block; }
button.week-day .who span { display: inline; }
button.month-cell:hover, button.week-day:hover { filter: brightness(.96); }
[data-bs-theme=dark] button.month-cell:hover, [data-bs-theme=dark] button.week-day:hover { filter: brightness(1.2); }
button.month-cell:focus-visible, button.week-day:focus-visible { outline: 2px solid var(--mw-accent); outline-offset: 2px; }
.month-cell .ho { font-size: .66rem; color: var(--mw-ink-2); white-space: nowrap; margin-top: 1px; }
.month-cell .ho .bi { font-size: .6rem; margin-right: .2rem; display: inline; }
.month-cell.split {
  background:
    linear-gradient(90deg, var(--pc0) var(--split), var(--pc) var(--split)) top / 100% 3px no-repeat,
    linear-gradient(90deg, color-mix(in srgb, var(--pc0) 13%, var(--mw-surface)) var(--split), color-mix(in srgb, var(--pc) 13%, var(--mw-surface)) var(--split));
  box-shadow: none;
}
.month-cell.split.today { box-shadow: inset 0 0 0 2px var(--mw-ink); }
.week-day.split {
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc0) 12%, var(--mw-surface)) var(--split), color-mix(in srgb, var(--pc) 12%, var(--mw-surface)) var(--split));
}
.legend-split {
  display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: -.02em;
  background: linear-gradient(90deg, var(--mw-ink-3) 60%, var(--mw-border-strong) 60%);
}
@media (max-width: 575.98px) { .month-cell .ho { display: none; } }

.day-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--mw-surface); }
.day-bar span { flex-basis: 0; background: var(--pc); }
.day-ticks { display: flex; justify-content: space-between; margin-top: .35rem; font-size: .68rem; color: var(--mw-ink-3); font-variant-numeric: tabular-nums; }
.day-who { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.day-who li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 .35rem; }
.day-who .legend-dot { margin-right: .1rem; }
.handover-box {
  display: flex; gap: .75rem; align-items: flex-start; margin-top: 1rem; padding: .8rem .95rem; border-radius: 12px;
  background: var(--mw-sand); border: 1px solid var(--mw-sand-border); font-size: .9rem;
}
.handover-box > .bi { font-size: 1.05rem; color: var(--mw-ink-2); margin-top: .1rem; }
.day-events { list-style: none; padding: 0; margin: 0; }
.day-events li { display: flex; align-items: baseline; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--mw-border); font-size: .9rem; }
.day-events li:first-child { border-top: 0; }
.day-events .when { flex-shrink: 0; width: 4.75rem; color: var(--mw-ink-3); font-size: .8rem; font-variant-numeric: tabular-nums; }
.handover-times { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: .9rem 0 .6rem; }
.handover-times dt { font-size: .75rem; font-weight: 500; color: var(--mw-ink-3); }
.handover-times dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.handover-times dd span { display: block; font-weight: 400; font-size: .78rem; color: var(--mw-ink-3); }

/* ---------- Schedule change request form & preview ---------- */
.handover-fields { border: 1px solid var(--mw-border); border-radius: 12px; padding: .85rem 1rem 1rem; }
.handover-fields legend { float: none; width: auto; font-size: .8rem; font-weight: 600; color: var(--mw-ink-2); padding: 0 .35rem; margin: 0 0 .25rem -.35rem; }
@media (min-width: 992px) { .effect-card { position: sticky; top: 1.5rem; } }
.effect-steps { position: relative; display: flex; flex-direction: column; gap: 1rem; }
.effect-steps::before { content: ''; position: absolute; left: 5px; top: .6rem; bottom: .6rem; width: 2px; background: var(--mw-border); }
.effect-step { position: relative; display: flex; gap: .85rem; }
.effect-step .dot { flex-shrink: 0; width: 12px; height: 12px; margin-top: .35rem; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 3px var(--mw-surface); }
.effect-table { font-size: .85rem; }
.effect-table > div { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr; gap: .5rem; padding: .4rem .5rem; border-radius: 8px; }
.effect-table > div.head { font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mw-ink-3); padding-bottom: .2rem; }
.effect-table > div.changed { background: var(--mw-surface-2); }
.month-cell.split .who { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
