:root {
    --navy: #12364a;
    --ocean: #26779b;
    --teal: #2a9d8f;
    --aqua: #55bfc4;
    --glass: #72b69a;
    --foam: #e2f4ee;
    --sky: #e8f4f8;
    --mist: #f5faf9;
    --white: #ffffff;
    --ink-soft: #52717c;
    --line: #d5e6e8;
    --danger: #9e3d4d;
    --danger-bg: #fff1f3;
    --shadow: 0 16px 42px rgba(18, 54, 74, .10);
    --radius: 20px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--sky); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--navy);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted, .subtitle { color: var(--ink-soft); }
.subtitle { margin: 4px 0 0; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: .78rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }

.brand-mark { width: 42px; height: 42px; overflow: visible; }
.brand-mark path { fill: none; stroke-linecap: round; }
.mark-ocean { stroke: var(--navy); stroke-width: 13; }
.mark-blue { stroke: var(--ocean); stroke-width: 11; }
.mark-teal { stroke: var(--teal); stroke-width: 10; }
.mark-aqua { fill: var(--aqua); }
.brand-mark-large { width: 88px; height: 88px; }

/* Login */
.login-body {
    background:
        radial-gradient(circle at 14% 10%, rgba(85,191,196,.22), transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(114,182,154,.24), transparent 35%),
        linear-gradient(145deg, var(--sky), #fbfdfd 52%, var(--foam));
    padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
}
.login-page { width: min(440px, 100%); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 28px; }
.login-brand h1 { margin: 0; font-size: clamp(2.2rem, 9vw, 3.3rem); letter-spacing: -.045em; line-height: 1; }
.login-brand h1 span { color: var(--teal); font-weight: 500; }
.login-brand p { color: var(--ink-soft); margin: 7px 0 0; font-size: 1.02rem; }
.login-card { background: rgba(255,255,255,.94); border: 1px solid rgba(213,230,232,.95); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-welcome h2 { margin: 0; font-size: 1.55rem; }
.login-welcome p { margin: 5px 0 22px; color: var(--ink-soft); }
label { display: block; font-weight: 700; font-size: .88rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid #bdd5d9;
    background: var(--white);
    color: var(--navy);
    border-radius: 13px;
    padding: 12px 13px;
    margin-top: 7px;
    min-height: 46px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(85,191,196,.25); border-color: var(--teal); }
.login-card label + label { margin-top: 16px; }
.primary-button, .quiet-button, .danger-button, .text-button, .icon-button, .back-button {
    border: 0; cursor: pointer; font-weight: 750;
}
.primary-button { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--teal), var(--ocean)); color: white; border-radius: 14px; min-height: 46px; padding: 11px 18px; box-shadow: 0 7px 18px rgba(42,157,143,.19); }
.primary-button:hover { filter: brightness(.98); }
.primary-button.compact { min-height: 40px; padding: 8px 14px; }
.login-card .primary-button { width: 100%; margin-top: 22px; }
.login-link-button { display: block; width: 100%; margin-top: 15px; border: 0; background: transparent; color: var(--ocean); font-weight: 750; cursor: pointer; }
.login-link-anchor { display: block; width: 100%; margin-top: 15px; color: var(--ocean); font-size: .9rem; font-weight: 750; text-align: center; text-decoration: none; }
.login-link-anchor:hover { text-decoration: underline; }
.login-form-help { margin: 0 0 17px; color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }
.login-field-help { margin: 7px 0 16px; color: var(--ink-soft); font-size: .78rem; font-weight: 500; line-height: 1.4; }
.recovery-primary-link { width: 100%; margin-top: 20px; text-decoration: none; }
#forgot-password-form label + label, #reset-password-form label + label { margin-top: 16px; }
.notice { border-radius: 13px; padding: 12px 14px; margin: 0 0 16px; font-size: .9rem; line-height: 1.4; }
.notice.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #ebc0c8; }
.notice.success { background: var(--foam); color: #256553; border: 1px solid #b8dfd0; }

/* App shell */
.app-body { background: linear-gradient(180deg, var(--sky) 0, #f8fbfb 210px, #f5f8f8 100%); }
.app-shell { min-height: 100vh; }
.connection-banner { position: sticky; z-index: 24; top: calc(70px + env(safe-area-inset-top)); width: min(100% - 28px, 1160px); margin: 0 auto; padding: 9px 14px; border: 1px solid #d7b867; border-radius: 0 0 13px 13px; background: #fff8dc; color: #684f14; text-align: center; font-size: .78rem; font-weight: 750; box-shadow: 0 7px 16px rgba(18,54,74,.08); }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: calc(70px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(18px, calc((100vw - 1100px)/2)) 0;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(232,244,248,.92); border-bottom: 1px solid rgba(197,221,225,.75); backdrop-filter: blur(18px);
}
.brand-button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; cursor: pointer; padding: 4px; }
.wordmark { font-size: 1.35rem; font-weight: 800; letter-spacing: -.035em; }
.wordmark i { color: var(--teal); font-style: normal; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.78); border: 1px solid var(--line); font-size: 1.7rem; line-height: 1; }
.primary-icon { color: white; background: var(--teal); border-color: var(--teal); box-shadow: 0 5px 14px rgba(42,157,143,.2); }
.avatar-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--ocean); color: white; font-weight: 800; cursor: pointer; }
.main-content { max-width: 1040px; margin: 0 auto; padding: 28px 24px 105px; }
.view { display: none; animation: view-in .18s ease-out; }
.view.active { display: block; }
@keyframes view-in { from { opacity: .45; transform: translateY(5px); } }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-heading h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.35rem); line-height: 1.08; letter-spacing: -.035em; }
.list-heading-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.delete-checked-button { color: var(--danger); background: var(--danger-bg); }
.today-heading { align-items: center; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-heading h2 { margin: 0; font-size: 1.25rem; }
.loading-card, .empty-state { padding: 28px; text-align: center; color: var(--ink-soft); border: 1px dashed #b9d3d7; background: rgba(255,255,255,.6); border-radius: var(--radius); }

/* Week strip and agenda */
.week-strip-wrap { position: relative; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; padding: 2px 1px 6px; touch-action: pan-y; }
.return-today { display: block; margin: 7px 0 0 auto; border: 0; background: transparent; color: var(--teal); font-weight: 800; cursor: pointer; }
.up-next { margin: 15px 0 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.72); }
.up-next-label { color: var(--teal); font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.up-next-title { margin-top: 3px; font-weight: 800; }
.up-next-time { color: var(--ink-soft); font-size: .8rem; margin-top: 2px; }
.day-chip { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.84); padding: 10px 6px; min-height: 70px; color: var(--navy); cursor: pointer; }
.day-chip span { display: block; text-transform: uppercase; font-size: .66rem; font-weight: 800; color: var(--ink-soft); }
.day-chip strong { display: block; margin-top: 6px; font-size: 1.05rem; }
.day-chip.active { background: linear-gradient(145deg, var(--teal), #369ea3); color: white; border-color: transparent; box-shadow: 0 8px 20px rgba(42,157,143,.2); }
.day-chip.active span { color: rgba(255,255,255,.8); }
.agenda-list { display: grid; gap: 10px; }
.agenda-card { --event-color: var(--teal); position: relative; display: grid; grid-template-columns: minmax(82px, auto) 1fr auto; align-items: center; gap: 14px; overflow: hidden; min-height: 72px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 17px; padding: 12px 14px 12px 18px; box-shadow: 0 5px 14px rgba(18,54,74,.045); cursor: pointer; text-align: left; }
.agenda-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--event-color); }
.agenda-time { font-weight: 800; font-size: .9rem; white-space: nowrap; }
.agenda-main { min-width: 0; }
.agenda-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-meta { color: var(--ink-soft); font-size: .78rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-stack { display: flex; flex-direction: row-reverse; justify-content: flex-end; }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; font-size: .72rem; border: 2px solid white; margin-left: -7px; }
.source-badge { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--event-color); color: white; font-size: .74rem; font-weight: 800; }

/* Calendar */
.calendar-heading { justify-content: center; align-items: center; }
.calendar-heading h1 { min-width: 220px; text-align: center; font-size: 1.7rem; }
.calendar-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.calendar-toolbar select { width: auto; min-width: 140px; margin: 0; min-height: 40px; padding: 8px 34px 8px 12px; }
.calendar-toolbar .primary-button { margin-left: auto; }
.quiet-button { min-height: 40px; border-radius: 12px; padding: 8px 13px; color: var(--teal); background: var(--foam); }
.month-calendar { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: 0 7px 20px rgba(18,54,74,.05); }
.weekday-row, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekday-row span { text-align: center; color: var(--ink-soft); text-transform: uppercase; font-size: .67rem; font-weight: 800; padding: 6px 0 10px; }
.month-day { position: relative; min-height: 82px; background: transparent; border: 0; border-top: 1px solid #edf3f3; padding: 9px 6px; cursor: pointer; text-align: center; color: var(--navy); }
.month-day.other { color: #9aaeaf; }
.month-day .date-number { width: 32px; height: 32px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; font-weight: 700; }
.month-day.today .date-number { box-shadow: inset 0 0 0 2px var(--teal); }
.month-day.selected .date-number { background: var(--teal); color: white; box-shadow: none; }
.event-dots { min-height: 10px; display: flex; justify-content: center; gap: 3px; margin-top: 6px; }
.event-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Lists */
.search-box { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: 15px; padding: 0 13px; margin-bottom: 16px; color: var(--ink-soft); }
.search-box span { font-size: 1.5rem; }
.search-box input { border: 0; background: transparent; margin: 0; padding-left: 0; }
.search-box input:focus { outline: 0; }
.lists-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.list-card { position: relative; display: grid; grid-template-columns: 54px 1fr 24px; align-items: center; gap: 13px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 19px; padding: 17px; min-height: 112px; box-shadow: 0 7px 18px rgba(18,54,74,.05); cursor: pointer; text-align: left; }
.list-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 1.45rem; font-weight: 800; }
.list-card h3 { margin: 0; font-size: 1.1rem; }
.list-card p { margin: 4px 0 10px; color: var(--ink-soft); font-size: .82rem; }
.progress-track { height: 5px; background: #e8eeee; border-radius: 999px; overflow: hidden; }
.progress-value { height: 100%; border-radius: inherit; }
.chevron { font-size: 1.7rem; color: #6d8991; }
.back-button { background: transparent; color: var(--teal); padding: 0; margin-bottom: 15px; font-size: .94rem; }
.quick-item-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 18px; padding: 11px; margin-bottom: 15px; }
.quick-item-form input { margin: 0; border: 0; background: transparent; }
.quick-item-form input:focus { outline: 0; }
.item-list { display: grid; gap: 9px; }
.list-item { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; background: rgba(255,255,255,.93); border: 1px solid var(--line); border-radius: 15px; padding: 12px; }
.list-section { margin: 9px 0 2px; padding: 11px 14px; border-radius: 13px; background: color-mix(in srgb, var(--item-color, var(--teal)) 15%, white); color: var(--navy); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; border: 1px solid color-mix(in srgb, var(--item-color, var(--teal)) 24%, white); }
.check-button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--item-color, var(--teal)); background: white; cursor: pointer; display: grid; place-items: center; color: white; font-weight: 900; }
.list-item.completed .check-button { background: var(--item-color, var(--teal)); }
.list-item.completed .item-name { color: #789096; text-decoration: line-through; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-sub { font-size: .76rem; color: var(--ink-soft); margin-top: 3px; }
.item-actions { display: flex; gap: 5px; }
.item-menu { border: 0; background: transparent; color: #799096; font-size: 1.25rem; cursor: pointer; padding: 6px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.settings-card { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 20px; padding: 19px; box-shadow: 0 7px 18px rgba(18,54,74,.045); }
.wide-card { grid-column: 1/-1; }
.settings-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.settings-card h2 { font-size: 1.15rem; margin: 0; }
.settings-card p { color: var(--ink-soft); margin: 4px 0 0; font-size: .84rem; line-height: 1.4; }
.stack-form { display: grid; gap: 13px; }
.stack-form input, .stack-form select { margin-top: 6px; }
.profile-widget-settings { border: 1px solid var(--line); border-radius: 16px; padding: 13px; background: linear-gradient(145deg, rgba(232,247,243,.72), rgba(232,244,248,.62)); }
.profile-widget-settings legend { padding: 0 6px; color: var(--navy); font-weight: 800; }
.profile-widget-settings > p { margin: -2px 0 7px; }
.widget-preference-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 1px; border-top: 1px solid rgba(160,202,205,.55); cursor: pointer; }
.widget-preference-row:first-of-type { border-top: 0; }
.widget-preference-row span, .widget-preference-row strong, .widget-preference-row small { display: block; }
.widget-preference-row strong { color: var(--navy); font-size: .88rem; }
.widget-preference-row small { margin-top: 3px; color: var(--ink-soft); font-size: .73rem; line-height: 1.35; }
.widget-preference-row input { flex: 0 0 auto; width: 25px; height: 25px; min-height: 0; margin: 0; accent-color: var(--teal); }
.preference-hidden { display: none !important; }
details { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
summary { cursor: pointer; font-weight: 700; }
.details-fields { display: grid; gap: 12px; margin-top: 12px; }
.member-list, .feed-list { display: grid; gap: 9px; }
.member-row, .feed-row { display: flex; align-items: center; gap: 11px; border-top: 1px solid #edf3f3; padding-top: 11px; }
.member-row:first-child, .feed-row:first-child { border-top: 0; padding-top: 0; }
.member-avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: 800; }
.member-info, .feed-info { min-width: 0; flex: 1; }
.member-info strong, .feed-info strong { display: block; }
.member-info span, .feed-info span { display: block; font-size: .76rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-action { border: 0; background: var(--foam); color: var(--teal); border-radius: 10px; padding: 7px 9px; cursor: pointer; font-size: .78rem; font-weight: 750; }
.feed-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.primary-row-action { background: var(--teal); color: white; }
.row-action:disabled { opacity: .58; cursor: wait; }
.feed-dot { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; background: #9db2b5; }
.status-dot.ok { background: var(--glass); }
.status-dot.error { background: var(--danger); }
.install-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(135deg, rgba(226,244,238,.95), rgba(232,244,248,.95)); }
.notification-settings-card { background: linear-gradient(145deg, rgba(255,255,255,.97), rgba(232,244,248,.92)); }
.notification-settings-body { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.notification-settings-body strong { display: block; }
.notification-settings-body p { margin-top: 3px; }
.notification-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.notification-status-badge { border-radius: 999px; background: var(--foam); color: var(--teal); padding: 6px 10px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.notification-status-badge.on { color: #2f755b; background: #dff2e9; }
.notification-status-badge.off { color: #7e5960; background: var(--danger-bg); }
.scheduler-details { margin-top: 15px; }
.scheduler-details p { margin: 9px 0; }
.cron-command-row { display: flex; align-items: center; gap: 8px; }
.cron-command-row code { min-width: 0; flex: 1; overflow-x: auto; background: var(--navy); color: white; border-radius: 10px; padding: 10px; font-size: .72rem; white-space: nowrap; }
.calendar-share-card { background: linear-gradient(145deg, rgba(255,255,255,.97), rgba(226,244,238,.78)); }
.calendar-share-settings { min-height: 54px; }
.calendar-share-settings > p, .calendar-share-intro > p { margin-top: 0; }
.calendar-share-control { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
.calendar-share-control label { min-width: 0; flex: 1; color: var(--navy); font-size: .78rem; font-weight: 800; }
.calendar-share-control select { display: block; width: 100%; min-width: 190px; margin-top: 6px; }
.calendar-share-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 12px; border-radius: 13px; background: var(--foam); }
.calendar-share-status strong { color: var(--teal); }
.calendar-share-status span { color: var(--ink-soft); font-size: .75rem; }
.calendar-share-link-label { display: block; margin-top: 16px; color: var(--navy); font-size: .78rem; font-weight: 800; }
.calendar-share-link-row { display: flex; align-items: stretch; gap: 8px; margin-top: 6px; }
.calendar-share-link-row input { min-width: 0; flex: 1; color: var(--ink-soft); font-size: .75rem; }
.outlook-subscribe-steps { margin: 16px 0 0; padding-left: 22px; color: var(--navy); font-size: .82rem; line-height: 1.55; }
.outlook-subscribe-steps li + li { margin-top: 4px; }
.calendar-share-note { margin-top: 14px !important; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.7); }
.calendar-share-actions { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.calendar-share-actions .danger-button { min-height: 36px; padding: 7px 10px; font-size: .78rem; }
.calendar-share-unavailable { padding: 16px; border: 1px dashed var(--line); border-radius: 13px; color: var(--ink-soft); text-align: center; }
.danger-button { background: var(--danger-bg); color: var(--danger); border-radius: 13px; min-height: 42px; padding: 10px 14px; }
#logout-button { display: block; margin: 22px auto 0; }
.version-label { text-align: center; color: #8aa0a5; font-size: .72rem; }

/* Dialogs */
.app-dialog { width: min(620px, calc(100vw - 24px)); max-height: min(860px, calc(100dvh - 28px)); border: 0; padding: 0; border-radius: 24px; color: var(--navy); box-shadow: 0 30px 80px rgba(18,54,74,.25); background: white; }
.app-dialog::backdrop { background: rgba(18,54,74,.46); backdrop-filter: blur(3px); }
.small-dialog { width: min(500px, calc(100vw - 24px)); }
.dialog-form { padding: 0 21px 22px; overflow-y: auto; max-height: inherit; }
.dialog-header { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 64px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); margin: 0 -21px 18px; padding: 0 19px; backdrop-filter: blur(14px); }
.dialog-header h2 { font-size: 1.08rem; margin: 0; text-align: center; }
.dialog-header .text-button:last-child { justify-self: end; }
.text-button { background: transparent; color: var(--teal); padding: 8px 0; }
.text-button.strong { font-weight: 850; }
.dialog-form > label, .dialog-form fieldset, .location-card-form, .dialog-form .two-column, .dialog-form .repeat-options { margin-top: 14px; }
.dialog-intro { color: var(--ink-soft); line-height: 1.45; }
.two-column, .repeat-options { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
fieldset { border: 0; padding: 0; }
legend { font-size: .88rem; font-weight: 750; margin-bottom: 8px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.everyone-chip { border: 1.5px solid var(--glass); background: white; color: #3c8065; border-radius: 11px; padding: 8px 12px; font-size: .85rem; font-weight: 750; cursor: pointer; }
.everyone-chip.selected { background: var(--glass); color: white; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 11px; border: 1.5px solid var(--chip-color); color: var(--chip-color); background: white; cursor: pointer; font-size: .85rem; }
.choice-chip input:checked + span { color: white; background: var(--chip-color); }
.choice-chip input:checked + span::after { content: "✓"; font-weight: 900; }
.choice-chip input:disabled + span { opacity: .35; cursor: not-allowed; filter: grayscale(.3); }
.event-notification-card { background: linear-gradient(145deg, var(--foam), var(--sky)); border: 1px solid #c9e2e0; border-radius: 17px; padding: 14px !important; }
.event-notification-card label { display: grid; gap: 6px; }
.event-notification-card p { color: var(--ink-soft); font-size: .76rem; line-height: 1.4; margin: 10px 0 0; }
#notification-recipient-wrap { margin-top: 12px; }
.field-hint { display: block; font-size: .8rem; font-weight: 750; margin-bottom: 7px; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
.switch-row input { width: 44px; height: 25px; min-height: 0; margin: 0; accent-color: var(--teal); }
.location-card-form { background: linear-gradient(145deg, var(--sky), var(--foam)); border: 1px solid #c9e2e0; border-radius: 17px; padding: 14px; }
.location-card-form label + label { margin-top: 10px; }
.location-card-form p, .privacy-note { margin: 9px 0 0; color: var(--ink-soft); font-size: .76rem; line-height: 1.4; }
.weekday-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-chips input { position: absolute; opacity: 0; }
.weekday-chips span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.weekday-chips input:checked + span { background: var(--teal); color: white; border-color: var(--teal); }
.dialog-form > .danger-button { width: 100%; margin-top: 18px; }
.event-detail-hero { text-align: center; padding: 4px 0 17px; }
.event-detail-hero h3 { font-size: 1.55rem; margin: 8px 0 4px; }
.event-detail-hero p { margin: 0; color: var(--ink-soft); }
.detail-row { display: flex; align-items: flex-start; gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; }
.detail-icon { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--foam); color: var(--teal); }
.detail-row strong, .detail-row span { display: block; }
.detail-row span { color: var(--ink-soft); font-size: .84rem; margin-top: 3px; line-height: 1.35; }
.directions-button { width: 100%; margin: 4px 0 12px; }
.sheet-dialog { margin-bottom: max(12px, var(--safe-bottom)); width: min(500px, calc(100vw - 20px)); }
.directions-form { text-align: center; }
.recurring-delete-form { text-align: center; }
.recurring-delete-form > p { margin: -5px 0 14px; color: var(--ink-soft); }
.delete-scope-option { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin: 9px 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--navy); text-align: left; cursor: pointer; }
.delete-scope-option strong { font-size: .95rem; }
.delete-scope-option span { margin-top: 3px; color: var(--ink-soft); font-size: .78rem; line-height: 1.35; }
.delete-scope-option:hover { border-color: var(--teal); background: var(--foam); }
.delete-scope-option.danger strong { color: var(--danger); }
.directions-form h2 { margin: 8px 0 16px; }
.sheet-handle { width: 42px; height: 5px; border-radius: 999px; background: #c7d4d6; margin: 10px auto 14px; }
.map-option { width: 100%; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 11px; margin-top: 9px; color: var(--navy); font-weight: 750; cursor: pointer; text-align: left; }
.map-badge { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; font-weight: 900; }
.map-badge.waze { background: var(--aqua); }.map-badge.apple { background: var(--ocean); }.map-badge.google { background: var(--glass); }
.directions-form .switch-row { margin: 14px 0 6px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); z-index: 100; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--navy); color: white; border-radius: 13px; padding: 11px 15px; box-shadow: var(--shadow); font-size: .88rem; }

/* Bottom navigation */
.bottom-nav { position: fixed; z-index: 25; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 720px); height: calc(70px + var(--safe-bottom)); padding: 6px 8px var(--safe-bottom); display: grid; grid-template-columns: repeat(var(--visible-nav-items, 5), 1fr); background: rgba(255,255,255,.95); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; backdrop-filter: blur(18px); box-shadow: 0 -8px 28px rgba(18,54,74,.08); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; color: #657f87; font-size: .69rem; cursor: pointer; }
.nav-icon { font-size: 1.35rem; line-height: 1; }
.nav-item.active { color: var(--teal); font-weight: 800; }

@media (min-width: 900px) {
    .main-content { padding-bottom: 125px; }
    .agenda-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .month-day { min-height: 96px; }
}

@media (max-width: 700px) {
    .topbar { padding-left: 14px; padding-right: 14px; }
    .main-content { padding: 21px 14px 98px; }
    .wordmark { font-size: 1.18rem; }
    .brand-mark { width: 36px; height: 36px; }
    .desktop-add { display: none; }
    .page-heading { margin-bottom: 16px; }
    .week-strip { gap: 5px; padding: 2px 0 7px; }
    .day-chip { min-width: 0; padding: 9px 2px; border-radius: 14px; }
    .agenda-card { grid-template-columns: 74px 1fr auto; gap: 10px; padding-right: 11px; }
    .lists-grid, .settings-grid { grid-template-columns: 1fr; }
    .wide-card { grid-column: 1; }
    .list-card { min-height: 96px; }
    .month-calendar { margin: 0 -8px; padding: 8px; border-radius: 18px; }
    .month-day { min-height: 60px; padding: 5px 1px; }
    .month-day .date-number { width: 29px; height: 29px; font-size: .82rem; }
    .event-dot { width: 5px; height: 5px; }
    .weekday-row span { font-size: .59rem; }
    .calendar-toolbar { flex-wrap: wrap; }
    .calendar-toolbar select { min-width: 128px; flex: 1; }
    .calendar-toolbar .primary-button { margin-left: 0; }
    .install-card { align-items: flex-start; flex-direction: column; }
    .notification-settings-body { align-items: flex-start; flex-direction: column; }
    .notification-settings-actions { justify-content: flex-start; }
    .cron-command-row { align-items: stretch; flex-direction: column; }
    .calendar-share-control, .calendar-share-link-row, .calendar-share-status { align-items: stretch; flex-direction: column; }
    .calendar-share-control select { min-width: 0; }
    .calendar-share-actions { align-items: stretch; flex-direction: column; }
    .feed-row { align-items: flex-start; flex-wrap: wrap; }
    .feed-actions { width: 100%; justify-content: flex-start; padding-left: 24px; }
    .two-column { grid-template-columns: 1fr; }
    .app-dialog { max-height: calc(100dvh - 16px); border-radius: 20px; }
}

@media (max-width: 430px) {
    .topbar-actions .primary-icon { display: none; }
    .calendar-toolbar .primary-button { padding-inline: 11px; }
    .agenda-card { grid-template-columns: 66px 1fr auto; }
    .agenda-time { font-size: .8rem; }
    .agenda-title { font-size: .91rem; }
    .list-card { grid-template-columns: 48px 1fr 18px; padding: 14px; }
    .list-icon { width: 46px; height: 46px; }
    .dialog-form { padding-left: 16px; padding-right: 16px; }
    .dialog-header { margin-left: -16px; margin-right: -16px; padding-left: 15px; padding-right: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Meds & Care — integrated Our Cove module */
.meds-home-widget { margin: 18px 0 22px; padding: 0; text-align: left; border: 1px solid #c7e2e1; background: linear-gradient(140deg, rgba(232,247,245,.94), rgba(232,244,248,.94)); overflow: hidden; }
.meds-home-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 16px 10px; }
.meds-home-head h2 { margin: 0; font-size: 1rem; }
.meds-home-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: .78rem; }
.meds-home-open { border: 0; background: white; color: var(--teal); font-weight: 800; border-radius: 12px; padding: 9px 12px; box-shadow: 0 5px 15px rgba(18,54,74,.08); cursor: pointer; }
.meds-home-profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; padding: 0 12px 12px; }
.meds-home-person { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 9px; min-height: 62px; padding: 10px; border: 1px solid rgba(114,182,154,.28); border-radius: 15px; background: rgba(255,255,255,.82); cursor: pointer; color: var(--navy); text-align: left; }
.meds-home-avatar { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--foam); color: var(--teal); font-weight: 900; }
.meds-home-copy strong, .meds-home-copy span { display: block; }
.meds-home-copy span { margin-top: 2px; font-size: .72rem; color: var(--ink-soft); }
.meds-home-count { font-size: .72rem; font-weight: 800; color: var(--ocean); }
.meds-home-count.overdue { color: #b45151; }

.meds-main-heading { align-items: center; }
.med-profile-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.meds-print-plan { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 9px 13px; border: 1px solid #bdd5d9; border-radius: 13px; background: white; color: var(--ocean); font-size: .78rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.meds-print-plan:hover { border-color: var(--teal); background: var(--foam); }
.med-profile-picker { min-width: 190px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-soft); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.med-profile-picker select { min-height: 43px; border-radius: 13px; background: white; color: var(--navy); font-weight: 800; text-transform: none; letter-spacing: 0; }
.meds-subnav { display: flex; gap: 7px; margin: 0 0 18px; padding: 5px; overflow-x: auto; background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 16px; scrollbar-width: none; }
.meds-subnav::-webkit-scrollbar { display: none; }
.meds-subnav button { flex: 1 0 auto; min-height: 38px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font-weight: 800; cursor: pointer; }
.meds-subnav button.active { color: white; background: linear-gradient(135deg, var(--teal), var(--ocean)); box-shadow: 0 5px 15px rgba(42,157,143,.18); }
.meds-content { padding: 0; text-align: left; border: 0; background: transparent; }
.meds-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.meds-date-control { display: flex; align-items: center; gap: 7px; }
.meds-date-control input { min-height: 40px; width: auto; padding: 7px 10px; border-radius: 11px; }
.meds-icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ocean); font-size: 1.15rem; cursor: pointer; }
.meds-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 17px; }
.meds-summary-card { min-height: 86px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.84); }
.meds-summary-card span, .meds-summary-card strong { display: block; }
.meds-summary-card span { color: var(--ink-soft); font-size: .72rem; font-weight: 800; }
.meds-summary-card strong { margin-top: 6px; font-size: 1.45rem; color: var(--ocean); }
.meds-progress { height: 9px; margin: 4px 0 18px; border-radius: 999px; overflow: hidden; background: #dceceb; }
.meds-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--aqua)); transition: width .2s ease; }

.meds-section { margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.84); box-shadow: 0 8px 24px rgba(18,54,74,.05); }
.meds-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.meds-section-head h2, .meds-section-head h3 { margin: 0; }
.meds-section-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: .8rem; }
.meds-schedule-list { display: grid; gap: 10px; }
.med-block { --med-accent: var(--teal); border: 1px solid var(--line); border-left: 5px solid var(--med-accent); border-radius: 16px; background: white; overflow: hidden; }
.med-block[data-type="tube"], .med-block[data-type="feeding"] { --med-accent: var(--ocean); }
.med-block[data-type="hydration"] { --med-accent: var(--aqua); }
.med-block[data-type="prn"] { --med-accent: var(--sea-glass); }
.med-block.overdue { box-shadow: inset 0 0 0 1px rgba(180,81,81,.18); }
.med-block.done { opacity: .78; }
.med-block-head { width: 100%; display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; padding: 13px; border: 0; background: transparent; color: var(--navy); text-align: left; cursor: pointer; }
.med-block-time { font-weight: 900; color: var(--med-accent); }
.med-block-title strong, .med-block-title span { display: block; }
.med-block-title span { margin-top: 3px; color: var(--ink-soft); font-size: .73rem; }
.med-block-status { border-radius: 999px; padding: 6px 9px; background: var(--foam); color: var(--teal); font-size: .68rem; font-weight: 900; }
.med-block-status.overdue { background: #fff0ef; color: #a74444; }
.med-block-body { display: none; padding: 0 12px 12px; }
.med-block.open .med-block-body { display: block; }
.med-item { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.med-check { width: 36px; height: 36px; border: 2px solid #a8cbc7; border-radius: 12px; background: white; color: white; font-size: 1rem; font-weight: 900; cursor: pointer; }
.med-check.checked { background: var(--teal); border-color: var(--teal); }
.med-item-copy strong, .med-item-copy span, .med-item-copy small { display: block; }
.med-item-copy span { margin-top: 2px; color: var(--ocean); font-size: .77rem; font-weight: 700; }
.med-item-copy small { margin-top: 4px; color: var(--ink-soft); line-height: 1.4; white-space: pre-line; }
.med-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.med-action { min-height: 31px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ocean); font-size: .67rem; font-weight: 800; cursor: pointer; }
.med-block-bulk { display: flex; justify-content: flex-end; gap: 7px; padding-top: 8px; border-top: 1px solid var(--line); }

.med-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 11px; }
.medication-card, .care-card, .schedule-admin-card, .history-row, .permission-card-cove { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.medication-card h3, .care-card h3, .schedule-admin-card h3 { margin: 0; font-size: 1rem; }
.medication-card p, .care-card p { margin: 6px 0 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.45; white-space: pre-line; }
.medication-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.med-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border-radius: 999px; background: var(--foam); color: var(--ocean); font-size: .68rem; font-weight: 800; }
.med-chip.refill { background: #e7f3fa; }
.med-card-actions { display: flex; gap: 7px; margin-top: 12px; }
.med-empty { padding: 24px; border: 1px dashed #b9d3d7; border-radius: 15px; background: rgba(232,247,245,.46); text-align: center; color: var(--ink-soft); }
.care-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 14px; align-items: start; }
.schedule-admin-list { display: grid; gap: 10px; }
.schedule-admin-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.schedule-admin-meta { color: var(--ink-soft); font-size: .75rem; margin-top: 3px; }
.schedule-item-admin { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.schedule-item-admin:first-of-type { margin-top: 10px; }
.schedule-item-admin span { color: var(--ink-soft); font-size: .75rem; }
.history-list { display: grid; gap: 8px; }
.history-row { display: grid; grid-template-columns: 115px 1fr auto; gap: 12px; align-items: center; }
.history-row time { color: var(--ink-soft); font-size: .72rem; }
.history-row strong, .history-row span { display: block; }
.history-row span { margin-top: 3px; color: var(--ink-soft); font-size: .75rem; }
.history-status { border-radius: 999px; padding: 5px 8px; background: var(--foam); color: var(--teal); font-size: .66rem; font-weight: 900; text-transform: capitalize; }
.audit-row { border-left: 3px solid var(--aqua); }

.med-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.med-setting-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 11px 0; border-top: 1px solid var(--line); }
.med-setting-row:first-of-type { border-top: 0; }
.med-setting-row strong, .med-setting-row span { display: block; }
.med-setting-row span { margin-top: 3px; color: var(--ink-soft); font-size: .75rem; }
.med-setting-row input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; accent-color: var(--teal); }
.med-setting-row select { width: auto; min-width: 95px; min-height: 40px; }
.med-notification-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; padding: 10px; border: 1px solid #c8e3e1; border-radius: 13px; background: var(--foam); color: var(--ink-soft); font-size: .75rem; line-height: 1.4; }
.permission-cards-cove { display: grid; gap: 10px; }
.med-profile-admin-list { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 12px; }
.med-profile-admin-list > div { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--foam); }
.med-profile-admin-list strong { font-size: .76rem; }
.permission-user-cove { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.permission-user-cove .member-avatar { flex: 0 0 auto; }
.permission-user-cove span { color: var(--ink-soft); font-size: .75rem; }
.permission-profile-cove { display: grid; grid-template-columns: minmax(90px,1fr) repeat(3,auto); gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.permission-profile-cove label { display: flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: .7rem; }
.permission-profile-cove input { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.med-import-map { display: grid; gap: 9px; margin: 12px 0; }
.med-import-row { display: grid; grid-template-columns: 1fr 25px 1fr; align-items: center; gap: 8px; }
.med-import-row select { min-height: 40px; }
.med-import-note { color: var(--ink-soft); font-size: .78rem; line-height: 1.5; }

.med-dialog { width: min(680px, calc(100vw - 24px)); }
.med-dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.med-dialog-grid .full { grid-column: 1 / -1; }
.med-checkbox-label { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-weight: 700 !important; text-transform: none !important; letter-spacing: 0 !important; }
.med-checkbox-label input { width: 20px; height: 20px; min-height: 0; accent-color: var(--teal); }
.weekday-toggle-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.weekday-toggle-grid label { display: block; }
.weekday-toggle-grid input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-toggle-grid span { display: grid; place-items: center; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink-soft); font-size: .72rem; font-weight: 800; }
.weekday-toggle-grid input:checked + span { background: var(--teal); border-color: var(--teal); color: white; }

@media (max-width: 760px) {
    .meds-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .care-layout, .med-settings-grid { grid-template-columns: 1fr; }
    .meds-main-heading { align-items: stretch; }
    .med-profile-actions { width: 100%; justify-content: stretch; }
    .meds-print-plan { flex: 1; }
    .med-profile-picker { width: 100%; }
    .history-row { grid-template-columns: 85px 1fr; }
    .history-status { grid-column: 2; justify-self: start; }
}

@media (max-width: 520px) {
    .meds-home-profiles { grid-template-columns: 1fr; }
    .meds-toolbar { align-items: stretch; flex-direction: column; }
    .meds-date-control { justify-content: space-between; }
    .meds-date-control input { flex: 1; min-width: 0; }
    .med-block-head { grid-template-columns: 58px 1fr; }
    .med-block-status { grid-column: 2; justify-self: start; }
    .med-item { grid-template-columns: 38px 1fr; }
    .med-item-actions { grid-column: 2; justify-content: flex-start; }
    .med-dialog-grid { grid-template-columns: 1fr; }
    .med-dialog-grid .full { grid-column: auto; }
    .permission-profile-cove { grid-template-columns: 1fr repeat(3,auto); gap: 6px; }
    .bottom-nav { padding-inline: 4px; }
    .nav-item { font-size: .62rem; }
}

@media (max-width: 520px) { .list-detail-heading { align-items: flex-start; } .list-heading-actions { flex-direction: column-reverse; align-items: stretch; } .list-heading-actions .quiet-button { white-space: nowrap; } }
