:root {
  --bg: #0f2830;
  --bg-card: #163840;
  --bg-elevated: #1d4a54;
  --text: #f4f7f8;
  --muted: #9fb8c0;
  --accent: #e9c46a;
  --accent-2: #2ec4b6;
  --danger: #e76f51;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); min-height: 100%; }
a { color: var(--accent-2); text-decoration: none; }
.app-main { padding: 1rem 1rem calc(var(--nav-h) + var(--safe-bottom) + 1rem); max-width: 720px; margin: 0 auto; }
.page-auth .app-main { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding-bottom: 1rem; background:
  radial-gradient(ellipse 80% 50% at 50% 0%, rgba(46, 196, 182, 0.12), transparent),
  var(--bg); }

.app-header { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; background: var(--bg-card); position: sticky; top: 0; z-index: 10; border-bottom: 1px solid #24525c; }
.app-brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .55rem; min-width: 0; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) { .brand-text { display: none; } }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand-dot.lg { width: 16px; height: 16px; }
.header-right { display: flex; align-items: center; gap: .5rem; }
.header-logout { font-size: .9rem; color: var(--muted); }
.header-mascots { display: inline-flex; align-items: center; gap: .35rem; margin-right: .35rem; }
.header-mascots .mascot-sm { margin-left: 0; }

.mascot {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 0 3px rgba(244,247,248,.12);
  background: #f4f7f8;
}
.mascot-xxs { width: 28px; height: 28px; }
.mascot-xs { width: 44px; height: 44px; }
.mascot-sm { width: 48px; height: 48px; box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 2px var(--accent-2); }
.mascot-md { width: 80px; height: 80px; box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 3px var(--accent); }
.mascot-lg { width: 120px; height: 120px; box-shadow: 0 10px 28px rgba(0,0,0,.55), 0 0 0 4px var(--accent-2); }
.mascot-xl { width: 140px; height: 140px; }
.mascot-you { outline: 3px solid var(--accent); outline-offset: 3px; z-index: 2; position: relative; transform: scale(1.06); }
.auth-dogs-row { display: flex; justify-content: center; align-items: flex-end; gap: 1.25rem; margin-bottom: 1rem; }
.auth-dog-label { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); font-weight: 600; }
.header-mascots .mascot-sm { margin-left: -8px; }
.header-mascots { gap: 0; }
.welcome-row { display: flex; align-items: center; gap: .85rem; margin-bottom: .25rem; }
.welcome-title { margin: 0; }
.welcome-sub { margin: .15rem 0 0; }
.task-owner { display: inline-flex; align-items: center; gap: .35rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.archive-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: .5rem; }
.archive-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 1rem; }
.archive-items { list-style: none; padding: 0; margin: 1rem 0 0; }
.archive-item { padding: .65rem 0; border-bottom: 1px solid #24525c; }
.archive-item.status-done { opacity: .65; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); background: var(--bg-card); border-top: 1px solid #24525c; display: grid; grid-template-columns: repeat(6, 1fr); z-index: 20; }
.nav-item span:last-child { font-size: .58rem; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .65rem; color: var(--muted); padding: .35rem; }
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 1.1rem; line-height: 1; }

.page-title { margin: .25rem 0 .5rem; font-size: 1.5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pad { padding: 1rem 0; }

.card { background: var(--bg-card); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card-title { margin: 0 0 .75rem; font-size: 1rem; }
.section-gap { margin-top: 1rem; }
.stack { display: flex; flex-direction: column; gap: .65rem; align-items: stretch; }
.stack > input,
.stack > select,
.stack > textarea,
.stack > .row-2,
.stack > .btn { width: 100%; max-width: 100%; min-width: 0; }
form.card { width: 100%; min-width: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (max-width: 480px) { .row-2 { grid-template-columns: 1fr; } }

.input, input, select, textarea { width: 100%; max-width: 100%; min-width: 0; border: 1px solid #2f616d; background: var(--bg-elevated); color: var(--text); border-radius: 10px; padding: .7rem .85rem; font-size: 1rem; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  line-height: 1.25;
  -webkit-appearance: none;
  appearance: none;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.btn { border: none; border-radius: 10px; padding: .65rem 1rem; font-size: .95rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), #1a9b8f); color: #032026; }
.btn-accent { background: var(--accent); color: #3d2e00; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid #2f616d; }
.btn-sm { padding: .35rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.danger { color: var(--danger) !important; border-color: #6b3a30 !important; }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.tile { background: var(--bg-card); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .25rem; color: var(--text); min-height: 110px; box-shadow: var(--shadow); }
.tile-value { font-size: 1.6rem; font-weight: 800; }
.tile-value.pos { color: #7dffb2; }
.tile-value.neg { color: #ff9b87; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-sub, .tile-cta { font-size: .75rem; color: var(--accent-2); margin-top: auto; }

.page-head-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }

.kanban { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.kanban-col { background: var(--bg-card); border-radius: var(--radius); padding: .75rem; }
.kanban-col h3 { margin: 0 0 .5rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.task-card { background: var(--bg-elevated); border-radius: 10px; padding: .65rem; margin-bottom: .5rem; }
.task-title { margin: 0; font-weight: 600; }
.task-meta { margin: .25rem 0 0; font-size: .8rem; color: var(--muted); }
.task-actions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .5rem; }

.check-list { list-style: none; padding: 0; margin: 1rem 0; }
.check-item { display: flex; gap: .75rem; align-items: center; padding: .85rem; background: var(--bg-card); border-radius: 12px; margin-bottom: .5rem; }
.check-item.done { opacity: .45; text-decoration: line-through; }
.check-box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--accent-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.shop-mode-head { text-align: center; margin-bottom: 1rem; }
.shop-mode-list { list-style: none; padding: 0; margin: 0; }
.shop-tap-item { margin-bottom: .65rem; }
.shop-tap-btn { width: 100%; border: none; border-radius: 16px; background: var(--bg-card); color: var(--text); padding: 1rem 1.1rem; display: flex; align-items: center; gap: 1rem; font-size: 1.1rem; text-align: left; min-height: 56px; box-shadow: var(--shadow); }
.shop-tap-btn:active { transform: scale(.98); }
.shop-tap-btn.checking { opacity: .6; }
.tap-circle { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--accent-2); flex-shrink: 0; }
.tap-text small { color: var(--muted); display: block; font-size: .85rem; }

.pantry-list { list-style: none; padding: 0; margin: 0; }
.pantry-row { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding: .75rem 0; border-bottom: 1px solid #24525c; }
.pantry-main { flex: 1; }
.pantry-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pantry-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.inline-form { display: inline; }
.stock-badge { font-size: .72rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.stock-ok { background: #1f4a42; color: #7dffb2; }
.stock-low { background: #4a4020; color: var(--accent); }
.stock-out { background: #4a2420; color: #ff9b87; }
.pantry-stock-out { border-left: 3px solid var(--danger); padding-left: .5rem; }
.pantry-stock-low { border-left: 3px solid var(--accent); padding-left: .5rem; }
.btn.active-stock { border-color: var(--accent-2); color: var(--accent); }

.budget-summary { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: 1rem 0; }
@media (min-width: 520px) { .budget-summary { grid-template-columns: repeat(3, 1fr); } }
.budget-pill { background: var(--bg-card); border-radius: 12px; padding: .75rem 1rem; text-align: center; font-weight: 700; }
.budget-pill.income { color: #7dffb2; }
.budget-pill.expense { color: #ff9b87; }
.budget-pill.balance.pos { color: var(--accent); }
.budget-pill.balance.neg { color: var(--danger); }

.bar-list, .simple-list, .tx-list { list-style: none; padding: 0; margin: 0; }
.bar-list li, .simple-list li { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid #24525c; }
.tx-row { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid #24525c; }
.tx-meta { text-align: right; }
.tx-amt { font-weight: 700; display: block; }

.month-nav { display: flex; align-items: center; gap: .35rem; }
.month-label { font-weight: 600; min-width: 8rem; text-align: center; text-transform: capitalize; }

.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem 1.25rem 1.75rem; box-shadow: var(--shadow); }
.auth-hero { text-align: center; margin-bottom: 1.25rem; }
.auth-hero h1 { margin: .5rem 0 .25rem; }

.flash-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash { padding: .6rem .8rem; border-radius: 10px; background: #1f5a4f; margin-bottom: .35rem; }
.flash-error { background: #5a2b24; }

.agenda-list { list-style: none; padding: 0; margin: 0; }
.agenda-list li, .agenda-row { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid #24525c; }
.check-inline { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-2 > * { min-width: 0; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.deadline-badge { color: var(--accent); font-weight: 600; }
.backlog-list { list-style: none; padding: 0; margin: 0; }
.backlog-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .65rem 0; border-bottom: 1px solid #24525c; }
.backlog-title { flex: 1 1 100%; font-weight: 600; }
.promote-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; flex: 1; }
.input-sm { padding: .45rem .55rem; font-size: .9rem; max-width: 9.5rem; }
.input-tall { min-height: 8rem; resize: vertical; line-height: 1.45; }
.planning-meeting-notes { white-space: pre-wrap; margin: .5rem 0 0; }
.stack > textarea.input { width: 100%; max-width: 100%; min-width: 0; }
.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
.planning-agenda { list-style: none; padding: 0; margin: 0; }
.planning-topic { display: flex; align-items: center; gap: .65rem; padding: .85rem; background: var(--bg-card); border-radius: 12px; margin-bottom: .5rem; }
.planning-topic.done { opacity: .55; text-decoration: line-through; }
.topic-check { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--accent-2); background: transparent; color: var(--text); font-size: 1.1rem; cursor: pointer; }
.topic-body { flex: 1; }