:root {
    --bg: #F2FBF5;
    --surface: #FFFFFF;
    --surface-2: #F6F7FC;      /* subtle raised/inset panels (calendar cells) */
    --hover: #F1F2F7;          /* neutral hover wash */
    --primary: #16A34A;
    --primary-dark: #15803D;
    --primary-soft: #DCFCE7;
    --text: #1E2033;
    --muted: #6B7280;
    --border: #E6E8F0;
    --danger: #EF4444;
    --error-bg: #FDECEC;
    --error-text: #B42318;
    --warn-bg: #FEF3C7;
    --warn-text: #92400E;
    --warn-soft: #FFF7ED;      /* "now" highlight in the day view */
    color-scheme: light;
}

/* Dark theme — follows the OS setting, or an explicit data-theme override. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #12131A;
        --surface: #1C1E28;
        --surface-2: #23252F;
        --hover: #262933;
        --primary: #4ADE80;
        --primary-dark: #86EFAC;
        --primary-soft: #14301F;
        --text: #E7E8EF;
        --muted: #9AA0AE;
        --border: #2E313D;
        --error-bg: #3A1D1D;
        --error-text: #FCA5A5;
        --warn-bg: #3A2E12;
        --warn-text: #FCD34D;
        --warn-soft: #2A2113;
        color-scheme: dark;
    }
}

/* Explicit user override (settings toggle), independent of OS. */
:root[data-theme="dark"] {
    --bg: #12131A;
    --surface: #1C1E28;
    --surface-2: #23252F;
    --hover: #262933;
    --primary: #4ADE80;
    --primary-dark: #86EFAC;
    --primary-soft: #14301F;
    --text: #E7E8EF;
    --muted: #9AA0AE;
    --border: #2E313D;
    --error-bg: #3A1D1D;
    --error-text: #FCA5A5;
    --warn-bg: #3A2E12;
    --warn-text: #FCD34D;
    --warn-soft: #2A2113;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.boot { padding: 48px; color: var(--muted); text-align: center; }

/* Never show a focus outline on headings (Blazor may focus them on navigation). */
h1:focus, h2:focus, h1:focus-visible, h2:focus-visible { outline: none; }

/* ---------- Shell ---------- */
.app-shell { max-width: 820px; margin: 0 auto; padding: 0 16px 48px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 4px 16px;
}
.brand { font-size: 22px; font-weight: 700; }
.user { display: flex; align-items: center; gap: 12px; }
.user .email { color: var(--muted); font-size: 14px; }

.content { }

/* ---------- Text ---------- */
.h1 { font-size: 26px; font-weight: 700; margin: 8px 0 2px; }
.muted { color: var(--muted); font-size: 14px; }
.pad { padding: 20px 4px; }
.center { text-align: center; }

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 14px rgba(58, 63, 99, .06);
    margin-bottom: 12px;
}

/* ---------- Inputs ---------- */
.input {
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.grow { flex: 1; min-width: 0; }
.block { width: 100%; }

.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-ghost {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 0; border-radius: 9px;
    padding: 8px 14px; font-weight: 600; cursor: pointer;
}
.btn-link { background: none; border: 0; color: var(--primary-dark); font-weight: 600; cursor: pointer; }
.btn-icon { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); padding: 6px; border-radius: 8px; }
.btn-icon:hover { background: var(--hover); }

/* ---------- Quantity stepper ---------- */
.qty-stepper { display: inline-flex; align-items: center; gap: 0; }
.qty-btn {
    width: 34px; height: 38px; flex: 0 0 auto;
    background: var(--surface2); border: 1px solid var(--border); color: var(--text);
    font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; user-select: none;
}
.qty-btn:first-child { border-radius: 10px 0 0 10px; }
.qty-btn:last-child { border-radius: 0 10px 10px 0; }
.qty-btn:hover:not(:disabled) { background: var(--hover); }
.qty-btn:disabled { opacity: .4; cursor: default; }
.qty-num {
    width: 48px; max-width: 48px; text-align: center; border-radius: 0;
    border-left: 0; border-right: 0; margin: 0;
    -moz-appearance: textfield;
}
.qty-num::-webkit-outer-spin-button, .qty-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Add form ---------- */
/* Line 1: task title spans the full width of the card. */
.add-title { display: block; width: 100%; margin: 0 0 10px 0; }

/* Line 2: priority + due date + Add button, all equal width and height. */
.add-row2 { display: flex; gap: 8px; align-items: stretch; }
.add-row2 > * {
    flex: 1 1 0;
    width: 0;            /* equal thirds regardless of content size */
    min-width: 0;
    height: 46px;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
    text-align: center;
    text-align-last: center; /* centres the <select> value */
    font-size: 15px;
}
.add-row2 .add-btn { padding-left: 0; padding-right: 0; }
.prio-select { font-weight: 700; }

/* ---------- Task rows ---------- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 14px; }
.prio-bar { width: 6px; align-self: stretch; border-radius: 3px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; }
.task-title.done { text-decoration: line-through; color: var(--muted); }
.task-due { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.task-due.overdue { color: var(--danger); font-weight: 600; }
.chip { color: #fff; font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 8px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Top tabs (icons, evenly spaced) ---------- */
.tabs { display: flex; gap: 8px; margin: 4px 0 18px; }
.tab {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    padding: 7px 6px;
    border-radius: 10px;
}
.tab-ic { font-size: 14px; line-height: 1; }
.tab:hover { background: var(--hover); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); }
.tab.active .tab-ic { transform: scale(1.08); }

/* ---------- Bottom nav (Water / Food / Admin) ---------- */
.content.has-bottom-nav { padding-bottom: 84px; }
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -2px 14px rgba(58, 63, 99, .07);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bnav {
    flex: 1; max-width: 160px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: var(--muted);
    font-size: 11px; font-weight: 600; padding: 6px 0; border-radius: 12px;
}
.bnav:hover { background: var(--hover); }
.bnav-ic { font-size: 21px; line-height: 1; }
.bnav.active { color: var(--primary-dark); }
.bnav.active .bnav-ic { transform: scale(1.08); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; margin: 2px 0 12px; }
.pill {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 600;
    color: var(--text); cursor: pointer;
}
.pill-on { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary-dark); }

/* ---------- Business / member bits ---------- */
.task-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.task-due.overdue { color: var(--danger); font-weight: 600; }
.input.mini { height: 38px; padding: 0 8px; font-size: 13px; max-width: 150px; }

/* ---------- Discreet recurrence editor ---------- */
.recur-badge {
    display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 7px;
    background: #EEF2FF; color: #4F46E5; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.recur { margin-top: 10px; }
.recur-toggle {
    background: none; border: 0; padding: 4px 0; cursor: pointer;
    color: var(--muted); font-size: 13px; font-weight: 500;
}
.recur-toggle:hover { color: var(--text); }
.recur-caret { display: inline-block; width: 12px; }
.recur-body { margin-top: 8px; }
.recur-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.daychips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.daychip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.daychip.on { background: #4F46E5; border-color: #4F46E5; color: #fff; }

.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.member-row:first-of-type { border-top: 0; }
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 600; }
.chip-grey { background: #E5E7EB; color: #4B5563; }
.chip-role { background: #E5E7EB; color: #4B5563; align-self: center; }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 10px; cursor: pointer; }

/* ---------- Calendar ---------- */
.cal-card { padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.cal-title { font-size: 18px; font-weight: 700; }
.cal-nav {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    width: 38px; height: 38px; cursor: pointer; font-size: 22px; line-height: 1;
    color: var(--primary-dark); display: flex; align-items: center; justify-content: center;
}
.cal-nav:hover { background: var(--primary-soft); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { margin-bottom: 6px; gap: 5px; }
.cal-dow-cell { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .05em; }

.cal-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
    padding: 6px 7px; cursor: pointer; overflow: hidden;
    display: flex; flex-direction: column; align-items: flex-start;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.cal-cell:hover { background: var(--surface); border-color: var(--primary); box-shadow: 0 2px 8px rgba(91,110,245,.12); }
.cal-other { background: transparent; border-color: transparent; }
.cal-other .cal-num { color: #B9BECF; font-weight: 500; }
.cal-other .cal-dots { display: none; }

.cal-num {
    font-size: 13px; font-weight: 600; color: var(--text); line-height: 20px;
    min-width: 20px; height: 20px; text-align: center; border-radius: 50%;
}
.cal-today .cal-num { background: var(--primary); color: #fff; padding: 0 2px; }
.cal-sel { border-color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }

.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: auto; padding-top: 4px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.cal-more { font-size: 9.5px; font-weight: 800; color: var(--muted); line-height: 6px; }

.cal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 5px 0;
    border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
.cal-item .cal-dot { width: 10px; height: 10px; }
.cal-item-title { flex: 1; min-width: 0; font-weight: 600; }
.cal-item-title.done { text-decoration: line-through; color: var(--muted); }
.cal-scope { font-size: 11.5px; color: var(--muted); background: var(--hover); padding: 3px 8px; border-radius: 8px; }
.cal-time { font-size: 11.5px; font-weight: 700; color: #4F46E5; background: #EEF2FF; padding: 3px 8px; border-radius: 8px; }

/* ---------- Calendar day view ---------- */
.day-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.day-title { flex: 1; min-width: 0; }
.day-title-main { font-size: 20px; font-weight: 800; }
.day-title-sub { font-size: 13px; color: var(--muted); }
.day-nav { display: flex; gap: 6px; }

.allday-card { padding: 14px 16px; margin-bottom: 14px; }
.allday-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.allday-add, .quickadd-cancel {
    background: none; border: 0; color: var(--primary); font-weight: 700; font-size: 13.5px; cursor: pointer;
}

.timeline { padding: 0; overflow: hidden; }
.slot {
    display: flex; gap: 12px; padding: 6px 14px; min-height: 46px;
    border-top: 1px solid var(--border); cursor: pointer;
}
.slot:first-child { border-top: 0; }
.slot:hover { background: var(--primary-soft); }
.slot-now { background: var(--warn-soft); }
.slot-time {
    width: 62px; flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--muted);
    padding-top: 6px; text-align: right;
}
.slot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }
.slot .cal-item { margin: 3px 0; padding: 6px 9px; }

.quickadd { display: flex; align-items: center; gap: 6px; padding: 4px 0; flex-wrap: wrap; }
.quickadd-title { flex: 2 1 140px; height: 40px; }
.quickadd-prio { flex: 0 0 auto; width: auto; height: 40px; }
.quickadd-btn { height: 40px; padding: 0 16px; }
.quickadd-cancel { font-size: 16px; }

/* ---------- Water / Food ---------- */
.big-stat { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big-num { font-size: 34px; font-weight: 800; }
.big-sub { color: var(--muted); font-size: 14px; }
.meter { height: 16px; background: #EDEFF5; border-radius: 8px; overflow: hidden; margin: 14px 0 8px; }
.meter-fill { height: 100%; border-radius: 8px; transition: width .25s; }
.meter-row { display: flex; justify-content: space-between; align-items: center; }
.goal-edit { display: flex; align-items: center; gap: 8px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-grid .pill { text-align: center; }
.goal-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.goal-val { font-weight: 700; min-width: 72px; text-align: center; }

.log-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.log-row:first-of-type { border-top: 0; }
.log-main { flex: 1; min-width: 0; }
.log-row > span:first-child { flex: 1; }

/* ---------- 7-day stats bars ---------- */
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bars { display: flex; align-items: flex-end; gap: 6px; margin-top: 14px; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-val { font-size: 10px; font-weight: 700; color: var(--muted); height: 13px; white-space: nowrap; }
.bar-track { width: 66%; height: 96px; background: #EDEFF5; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; min-height: 3px; border-radius: 6px; transition: height .25s; }
.bar-fill.bar-hit { box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.bar-label { font-size: 11px; color: var(--muted); }
.bar-label.bar-today { color: var(--primary); font-weight: 800; }

/* ---------- Edit sheet (long-press) ---------- */
.sheet-overlay { position: fixed; inset: 0; background: rgba(20,22,40,.45); display: flex;
    align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
    padding: 18px 18px 24px; box-shadow: 0 -8px 30px rgba(0,0,0,.22); animation: sheet-up .18s ease; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.task-main { cursor: pointer; }

/* ---------- Stats page ---------- */
.stat-tiles { display: flex; gap: 10px; margin-bottom: 14px; }
.stat-tile { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-cap { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prio-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.prio-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.prio-name { width: 62px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.prio-bar { flex: 1; height: 10px; background: #EDEFF5; border-radius: 6px; overflow: hidden; }
.prio-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width .25s; }
.prio-count { width: 22px; text-align: right; font-weight: 700; font-size: 13px; }
.bar-col.clickable { cursor: pointer; border-radius: 8px; padding: 2px 0; }
.bar-col.clickable:hover, .bar-col.bar-sel { background: var(--primary-soft); }
.hour-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.hour-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.hour-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.hour-row:first-of-type { border-top: 0; }
.hour-time { width: 76px; flex-shrink: 0; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.hour-val { flex: 1; min-width: 0; }
.hour-cal { color: #F59E0B; font-weight: 700; font-size: 13px; white-space: nowrap; }
.hour-total { margin-top: 8px; font-weight: 800; text-align: right; }

/* ---------- Profile ---------- */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.field { min-width: 0; display: flex; flex-direction: column; }
.field-full { grid-column: 1 / -1; }
.field .field-label { margin: 0 0 5px; }
.field .input { width: 100%; box-sizing: border-box; height: 46px; }
.target-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 0; border-top: 1px solid var(--border); }
.target-row:first-of-type { border-top: 0; }
.target-num { font-size: 22px; font-weight: 800; }

/* ---------- Encrypted chat ---------- */
.chat-card { display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-key-btn { font-size: 15px; }
.chat-log { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; padding: 4px; }
.chat-msg { max-width: 82%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-sender { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 0 4px 2px; }
.chat-bubble {
    display: inline-block; padding: 8px 12px; border-radius: 14px; font-size: 14px;
    background: #EEF0F7; color: var(--text); text-align: left; word-break: break-word; white-space: pre-wrap;
}
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; }
.chat-time { font-size: 10.5px; color: var(--muted); margin: 2px 6px 0; }
.chat-input { margin-top: 4px; }

/* ---------- Personal notes ---------- */
.note-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.note-text { flex: 1; min-width: 0; resize: vertical; font-family: inherit; padding: 8px 10px; }

/* ---------- Admin member rows ---------- */
.admin-member { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 0; border-top: 1px solid var(--border); }
.admin-member:first-of-type { border-top: 0; }
.admin-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.section-head { font-size: 15px; font-weight: 800; color: var(--muted); margin: 22px 4px 10px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; padding: 24px; }
.switch { margin-top: 14px; font-size: 14px; color: var(--muted); display: flex; gap: 6px; justify-content: center; }

/* ---------- Notices ---------- */
.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
.notice-error { background: var(--error-bg); color: var(--error-text); }
.notice-ok { background: #E9F7EF; color: #1E7A46; }

/* ---------- Blazor error ---------- */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--warn-bg); color: var(--warn-text);
    padding: 12px 20px; box-shadow: 0 -2px 10px rgba(0,0,0,.1);
}
#blazor-error-ui .reload { color: #92400E; font-weight: 600; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---------- Food search results ---------- */
.food-results { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.food-row { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.food-row.open { border-color: var(--primary); }
.food-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.food-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; }
.food-cat { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.food-kcal { color: #F59E0B; font-weight: 700; white-space: nowrap; }
.food-kcal-u { color: var(--muted); font-weight: 400; font-size: 12px; }
.food-badge {
    display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700;
    color: var(--warn-text); background: var(--warn-bg); padding: 1px 7px; border-radius: 999px;
}
.food-exp { padding: 0 12px 12px; }

/* SOS alert and the child's location */
.sos-alert { background: #DC2626; color: #fff; border-radius: 18px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(220, 38, 38, .35); }
.sos-title { font-size: 20px; font-weight: 800; }
.sos-when { opacity: .85; font-size: 13px; }
.sos-body { margin-top: 6px; }
.sos-alert .btn-ghost { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .5); }
.sos-alert .btn-primary { background: #fff; color: #B91C1C; }
.map { width: 100%; height: 240px; border: 1px solid var(--border); border-radius: 14px; margin-top: 10px; }

/* Rules editor */
.rules-table { width: 100%; border-collapse: collapse; margin: 4px 0; }
.rules-table th { font-size: 13px; font-weight: 600; text-align: left; padding: 4px; }
.rules-table td { padding: 4px; font-size: 14px; }
.rules-table .input { width: 100%; }
.rules-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.rules-apps label, .rules-nums label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.rules-apps textarea { resize: vertical; font-size: 14px; }
.rules-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
