/* The White House - clean and minimal, warm neutrals. Colors come from our actual house:
   dark blue (the accent) and a red front door (used sparingly). Kept muted so it never reads as a flag. */

:root {
    --bg: #faf8f4;
    --card: #ffffff;
    --ink: #24262a;
    --muted: #7a7670;
    --line: #ebe6dd;
    --accent: #34507a;
    --accent-soft: #e5ebf3;
    --door: #b04a3c;
    --warn: #b9772f;
    --warn-soft: #f7ecdf;
    --late: #b04a3c;
    --late-soft: #f6e4df;
    --shadow: 0 1px 2px rgba(40, 32, 20, 0.05), 0 2px 10px rgba(40, 32, 20, 0.04);
    --radius: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15181e;
        --card: #1e222a;
        --ink: #eceae6;
        --muted: #9a978f;
        --line: #2c313b;
        --accent: #9db5d9;
        --accent-soft: #252e3c;
        --door: #b9584a;
        --warn: #e0a666;
        --warn-soft: #3a3024;
        --late: #e58b7c;
        --late-soft: #3d2824;
        --shadow: none;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px 4px; font-weight: 600; }
.muted { color: var(--muted); margin: 4px 0 0; }
.small { font-size: 0.85rem; margin: 6px 4px; }
.hidden { display: none !important; }
.big-emoji { font-size: 2.6rem; margin-bottom: 6px; }

/* ===== Sign-in screens ===== */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card, .welcome { text-align: center; max-width: 340px; width: 100%; }
.welcome { margin: 12vh auto 0; }
.auth-card .btn, .welcome .btn { margin-top: 16px; }
.auth-logo { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.auth-error { color: var(--late); font-size: 0.9rem; }

/* ===== Layout ===== */
#view { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(96px + var(--safe-bottom)); }
@supports (padding-top: env(safe-area-inset-top)) { #view { padding-top: calc(20px + env(safe-area-inset-top)); } }
.demo-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 0.8rem; padding: 6px 12px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 4px 20px; }
.group { margin-bottom: 22px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 0; }
.notes { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; white-space: pre-wrap; margin: 0 0 8px; }

/* ===== Rows ===== */
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); min-height: 56px; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.card > .row:first-child { border-top: 0; }
.row-plain { cursor: pointer; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row-icon { margin-right: 6px; }
.row-meta { color: var(--muted); font-size: 0.83rem; margin-top: 1px; }
.row-due { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.row.today .row-due { color: var(--accent); font-weight: 600; }
.row.overdue .row-due { color: var(--late); font-weight: 600; }
.row.nodate .row-due { color: var(--warn); }
.row.done .row-title { text-decoration: line-through; color: var(--muted); }

.check { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); cursor: pointer; position: relative; transition: all 0.2s; }
.row.today .check { border-color: var(--accent); }
.row.overdue .check { border-color: var(--late); }
.check:active { transform: scale(0.9); }
.check.checked { background: var(--accent); border-color: var(--accent); }
.check.checked::after { content: ''; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

.situation h3 { color: var(--late); }
.siren { display: inline-block; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.empty { text-align: center; padding: 28px 12px; }
.empty p { margin: 4px 0; }

/* ===== Buttons ===== */
.btn { display: inline-block; border: 1px solid var(--line); background: var(--card); padding: 12px 18px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0f1520; } }
.btn-danger { color: var(--late); margin-top: 18px; }
.btn-block { display: block; width: 100%; margin-bottom: 18px; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px 4px; cursor: pointer; }
.link-btn.strong { font-weight: 700; }
.back { margin: 0 0 8px -4px; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.badge { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: 0.7rem; font-weight: 600; vertical-align: middle; }

/* ===== Tasks segmented control ===== */
.segmented { display: flex; background: var(--line); border-radius: 10px; padding: 3px; margin: -8px 0 16px; }
.seg { flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.seg.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ===== Projects ===== */
.progress { display: block; height: 4px; background: var(--line); border-radius: 2px; margin-top: 7px; overflow: hidden; max-width: 220px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.add-row input { border: 0; background: none; padding: 6px 0; flex: 1; }
.add-row input:focus { outline: none; }
.over { color: var(--late); }
.sign-btn { margin-top: 26px; background: var(--door); border-color: var(--door); color: #fff !important; }
.signed { margin: -8px 4px 16px; color: var(--muted); }
.signature { font-family: "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive; font-size: 1.35em; color: var(--ink); }
a.row-main { color: inherit; text-decoration: none; }

/* ===== Directory ===== */
.section-head.first { margin-top: 0; }
.sub-head { margin: 14px 4px 6px; font-size: 0.9rem; font-weight: 600; }
.spaced { margin-top: 30px; }
.call-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.1rem; }
.biz-cat { margin: 0 2px 14px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.contact-grid .btn { text-align: center; text-decoration: none; color: var(--accent); padding: 12px 8px; }

/* ===== Pets ===== */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pet-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; text-align: center; }
.pet-emoji { font-size: 2.4rem; display: inline-block; }
.pet-emoji.big { font-size: 3.2rem; }
.pet-name { font-weight: 700; font-size: 1.1rem; }
.pet-hero { display: flex; align-items: center; gap: 14px; margin: 4px 4px 16px; }
.pet-hero > div { flex: 1; }
.wag { transform-origin: 70% 80%; animation: wag 2.8s ease-in-out infinite; }
@keyframes wag { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-8deg); } 88% { transform: rotate(8deg); } 92% { transform: rotate(-6deg); } 96% { transform: rotate(4deg); } }

/* ===== Tab bar ===== */
.tab-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom)); z-index: 10; }
.tab { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 1px; background: none; border: 0; color: var(--muted); font-size: 0.68rem; font-weight: 600; padding: 4px 0; cursor: pointer; }
.tab-icon { font-size: 1.25rem; line-height: 1.4; filter: grayscale(1); opacity: 0.7; }
.tab.active { color: var(--accent); }
.tab.active .tab-icon { filter: none; opacity: 1; }

/* ===== Bottom sheet (forms and action menus) ===== */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 18, 14, 0.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: rise 0.25s ease-out; padding-bottom: var(--safe-bottom); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1rem; margin: 0; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.actions-only .sheet-head .strong { visibility: hidden; }
.action-btn { margin-bottom: 8px; text-align: left; font-weight: 500; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.field { display: block; margin-bottom: 14px; }
.label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin: 0 0 5px 2px; }
.hint { display: block; font-size: 0.78rem; color: var(--muted); margin: 4px 2px 0; }
.form-heading { margin: 22px 0 2px 2px; font-size: 0.95rem; }
.form-heading + .hint { margin-bottom: 12px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type="date"], input[type="time"] { min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input { width: 80px; }
.inline select { flex: 1; }

/* ===== Toast and fun effects ===== */
.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 0.9rem; font-weight: 500; z-index: 30; max-width: calc(100% - 32px); text-align: center; animation: rise 0.2s ease-out; }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }

.stamp { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); border: 4px solid var(--late); color: var(--late); padding: 8px 18px; border-radius: 10px; text-align: center; font-weight: 800; letter-spacing: 0.12em; background: color-mix(in srgb, var(--bg) 80%, transparent); animation: stamp 1.9s ease-out forwards; }
.stamp-word { display: block; font-size: 1.8rem; }
.stamp-sub { display: block; font-size: 0.7rem; letter-spacing: 0.08em; font-weight: 600; }
@keyframes stamp {
    0% { transform: translate(-50%, -50%) rotate(-12deg) scale(2.2); opacity: 0; }
    12% { transform: translate(-50%, -50%) rotate(-12deg) scale(0.95); opacity: 1; }
    18% { transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.stroller { position: absolute; bottom: calc(76px + var(--safe-bottom)); left: -160px; display: flex; align-items: flex-end; gap: 6px; animation: stroll 6s linear forwards; }
.stroller-pet { font-size: 2.4rem; display: inline-block; transform: scaleX(-1); animation: bob 0.5s ease-in-out infinite; }
.stroller-say { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; font-size: 0.8rem; white-space: nowrap; margin-bottom: 30px; box-shadow: var(--shadow); }
@keyframes stroll { to { left: 110%; } }
.signing { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); padding: 18px 28px; text-align: center; animation: fadeout 2.8s ease-in forwards; }
.signing-title { display: block; white-space: nowrap; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.signing .signature { display: inline-block; font-size: 2.2rem; clip-path: inset(0 100% 0 0); animation: write 1.1s 0.2s ease-out forwards; }
.signing-paw { display: block; font-size: 1.4rem; opacity: 0; animation: pop 0.3s 1.3s ease-out forwards; }
@keyframes write { to { clip-path: inset(0 0 0 0); } }
@keyframes pop { from { transform: scale(2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeout { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bob { 50% { transform: scaleX(-1) translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
    .wag, .siren, .stroller-pet { animation: none; }
    .stroller { animation-duration: 0.01s; }
}
