/* ---------- Colors: light theme (default) ---------- */
:root {
  --bg: #f4f5fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #eceef5;
  --accent: #6366f1;          /* indigo: change this one line to recolor the app */
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.06);
  --radius: 18px;
}

/* ---------- Colors: dark theme ---------- */
:root[data-theme="dark"] {
  --bg: #0b1020;
  --panel: #141a2e;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --line: #232a42;
  --accent-soft: #1e2448;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
/* v26: family crest instead of the house emoji */
.brand-icon { width: 34px; height: 60px; object-fit: contain; flex: none; }
.auth-logo { color: var(--muted); text-align: center; }
.auth-logo svg { width: 190px; height: auto; max-width: 70%; }
.brand b { display: block; font-size: 17px; }
.brand small { color: var(--muted); font-size: 12px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.sidebar nav a:hover { background: var(--accent-soft); color: var(--ink); }
.sidebar nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35); }
.sidebar nav a.soon { opacity: 0.55; cursor: default; }
.sidebar nav a em { margin-left: auto; font-style: normal; font-size: 11px; }

.theme-toggle {
  background: var(--accent-soft); color: var(--ink);
  border: 0; border-radius: 12px; padding: 11px; font: inherit; cursor: pointer;
}

/* ---------- Top bar ---------- */
.content { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 28px 32px 8px;
}
.topbar h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.address { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.widgets { display: flex; gap: 12px; }
.widget {
  background: var(--panel); border-radius: 14px; padding: 10px 16px; box-shadow: var(--shadow);
  min-width: 150px;
}
.widget small { display: block; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.widget b { font-size: 20px; font-variant-numeric: tabular-nums; }

main { padding: 16px 32px 40px; max-width: 1200px; }
h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }

/* ---------- Summary cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.card {
  background: var(--panel); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }
.card .ic {
  grid-row: span 2; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px; background: var(--accent-soft);
}
.card small { color: var(--muted); font-size: 13px; }
.card b { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.card.alert { background: linear-gradient(135deg, #ef4444, #f97316); color: #fff; }
.card.alert small { color: rgba(255, 255, 255, 0.85); }
.card.alert .ic { background: rgba(255, 255, 255, 0.2); }

/* ---------- Panels ---------- */
.box {
  background: var(--panel); border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ---------- Forms ---------- */
.form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form h2 { width: 100%; margin-bottom: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
input, select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35); }
button.small { padding: 7px 12px; font-size: 12px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover, tr:hover td { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; }
form.inline { display: inline-flex; gap: 6px; margin: 0; }
form.inline input { padding: 6px 8px; font-size: 12px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border-radius: 10px; background: var(--accent-soft); text-decoration: none; font-size: 15px;
}
.icon-btn.danger { background: #fee2e2; }
.icon-btn:hover { box-shadow: none; transform: scale(1.08); }

/* ---------- Status badges ---------- */
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gray { background: var(--accent-soft); color: var(--muted); }

/* ---------- Year pills ---------- */
.years { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.years a {
  padding: 8px 16px; border-radius: 999px; background: var(--panel); color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.years a.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

a { color: var(--accent); }

/* ---------- Phone: sidebar becomes a top bar ---------- */
@media (max-width: 800px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex: unset; }
  .brand small, .sidebar nav a.soon, .theme-toggle { display: none; }
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .widgets { width: 100%; }
  .widget { flex: 1; min-width: 0; }
}

/* ---------- v14: messages, tabs, categories, charts ---------- */
.msg { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 500; }
.msg.error { background: #fee2e2; color: #991b1b; }
.msg.warn { background: #fef3c7; color: #92400e; }

.box-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.box-head h2 { margin: 0; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tabs a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.tabs a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

.badge.warn { background: #fef3c7; color: #92400e; margin-left: 6px; cursor: help; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 999px; background: var(--accent-soft); font-weight: 500;
}
.chip em { font-style: normal; font-size: 12px; color: var(--muted); }
.chip-x {
  width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 11px;
  background: rgba(220, 38, 38, 0.15); color: #dc2626;
}
.chip-x:hover { box-shadow: none; background: #dc2626; color: #fff; }
.hint { color: var(--muted); font-size: 13px; }

.grid2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.grid2 .box { margin-bottom: 20px; }
td.bar-cell { width: 40%; }
.bar { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); min-width: 4px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- v15: bank page ---------- */
.msg.ok { background: #dcfce7; color: #166534; }
.msg.info { background: var(--accent-soft); color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
td.num.pos { color: #16a34a; font-weight: 700; }
td.num.neg { color: var(--ink); }
small.sub { display: block; color: var(--muted); font-size: 12px; max-width: 320px; white-space: normal; }
.remember { flex-direction: row; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; }
.remember input { padding: 0; }
form.inline select { padding: 6px 8px; font-size: 13px; }
.upload input[type=file] { background: var(--panel); }
code { background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; }

/* ---------- v16: collapsible sidebar ---------- */
.topbar { justify-content: flex-start; }
.topbar .widgets { margin-left: auto; }
.title-block { min-width: 0; }
.menu-toggle {
  width: 42px; height: 42px; padding: 0; border-radius: 12px; font-size: 20px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
}
.menu-toggle:hover { box-shadow: var(--shadow); }
.sidebar { transition: width 0.25s ease, padding 0.25s ease; overflow: hidden; }
html.collapsed .sidebar { width: 76px; padding-left: 12px; padding-right: 12px; }
html.collapsed .sidebar .lbl,
html.collapsed .brand > div { display: none; }
html.collapsed .sidebar nav a { justify-content: center; padding: 11px 0; }
html.collapsed .brand { justify-content: center; padding: 0; }
html.collapsed .theme-toggle { padding: 11px 0; }
.sidebar nav a .lbl { display: flex; align-items: center; gap: 6px; flex: 1; }
.sidebar nav a .lbl em { margin-left: auto; }
@media (max-width: 800px) {
  html.collapsed .sidebar { display: none; }
}

/* ---------- v17: info messages keep their text in one block ---------- */
.msg.info { flex-wrap: nowrap; justify-content: space-between; }
.msg-text { flex: 1; line-height: 1.5; }
.msg.info form.inline { flex-shrink: 0; }
@media (max-width: 800px) { .msg.info { flex-wrap: wrap; } }

/* ---------- v18: content always centered in the free space ---------- */
.topbar, main { max-width: 1200px; margin-left: auto; margin-right: auto; box-sizing: border-box; width: 100%; }

/* ---------- v20: menu button next to the "Otthon" title ---------- */
.menu-toggle.in-sidebar {
  margin-left: auto; width: 36px; height: 36px; font-size: 17px; flex-shrink: 0;
  background: var(--accent-soft); box-shadow: none;
}
.menu-toggle.mobile-only { display: none; }
html.collapsed .brand { flex-direction: column; gap: 10px; }
html.collapsed .menu-toggle.in-sidebar { margin-left: 0; }
@media (max-width: 800px) {
  .menu-toggle.mobile-only { display: inline-grid; place-items: center; }
  .menu-toggle.in-sidebar { display: none; }
}

/* ---------- v22: login, users, theme button ---------- */
.theme-btn {
  width: 46px; height: 46px; padding: 0; border-radius: 14px; font-size: 20px;
  background: var(--panel); box-shadow: var(--shadow); align-self: center;
}
.theme-btn:hover { box-shadow: var(--shadow); }
.theme-toggle { display: none; }
.view-picker select { margin-top: 2px; padding: 4px 8px; font-size: 13px; }
.user-box { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.user-box a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-weight: 600; }
.user-box a:hover, .user-box a.active { background: var(--accent-soft); }
.user-box form { margin: 0; }
.logout { width: 100%; background: transparent; color: var(--muted); text-align: left; padding: 10px 14px; font-weight: 500; }
.logout:hover { background: var(--accent-soft); color: var(--ink); box-shadow: none; transform: none; }
html.collapsed .user-box a, html.collapsed .logout { justify-content: center; text-align: center; padding: 10px 0; }
td.center { text-align: center; }
.perm-picks { width: 100%; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 18px 0 12px; }
.form.vertical { flex-direction: column; align-items: stretch; }
.form.vertical button { margin-top: 6px; }

/* v47: the v22/v27 light-mode tints were removed: hud.css styles every panel now. */

/* ---------- v28: login page showcase and decorated background ---------- */
.auth-bg {
  position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, #dbeafe 0, transparent 42%),
    radial-gradient(circle at 88% 82%, #ede9fe 0, transparent 42%),
    radial-gradient(circle at 70% 10%, #fef3c7 0, transparent 30%),
    var(--bg);
}
:root[data-theme="dark"] .auth-bg {
  background:
    radial-gradient(circle at 12% 18%, #1e2a5a 0, transparent 42%),
    radial-gradient(circle at 88% 82%, #2a1f55 0, transparent 42%),
    radial-gradient(circle at 70% 10%, #3a2a10 0, transparent 30%),
    var(--bg);
}
.auth-bg span { position: absolute; opacity: 0.16; animation: auth-float 10s ease-in-out infinite; }
:root[data-theme="dark"] .auth-bg span { opacity: 0.12; }
@keyframes auth-float { 50% { transform: translateY(-16px) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .auth-bg span { animation: none; } }

.auth-wrap {
  position: relative; z-index: 1; width: 100%; max-width: 1040px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 48px; align-items: center;
}
.auth-wrap .auth-card { max-width: 400px; }
.hero-greet { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.hero-greet #hero-date { font-weight: 400; text-transform: capitalize; }
.hero-title {
  margin: 6px 0 10px; font-size: 40px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1d4ed8, #b91c1c 60%, #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .hero-title { background-image: linear-gradient(135deg, #93c5fd, #fca5a5 60%, #fcd34d); }
.hero-lead { margin: 0 0 16px; color: var(--ink); opacity: 0.85; line-height: 1.55; max-width: 560px; }
.hero-live { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hero-live .pill {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel); box-shadow: var(--shadow);
}
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.feat {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #dbeafe, #eef4ff); border: 1px solid #bfdbfe;
  transition: transform 0.2s;
}
.feat:hover { transform: translateY(-2px); }
.feat b { display: block; font-size: 14px; }
.feat small { display: block; color: #475569; font-size: 12px; line-height: 1.4; margin-top: 2px; }
.feat-ic {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; background: rgba(255, 255, 255, 0.8);
}
.feat.soon { grid-column: 1 / -1; background: linear-gradient(135deg, #fef3c7, #fffbeb); border-color: #fde68a; }
:root[data-theme="dark"] .feat { background: var(--panel); border-color: var(--line); }
:root[data-theme="dark"] .feat small { color: var(--muted); }
:root[data-theme="dark"] .feat-ic { background: var(--accent-soft); }
:root[data-theme="dark"] .feat.soon { background: #2a2210; border-color: #4a3a14; }
.tip {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel); box-shadow: var(--shadow); font-size: 13px; line-height: 1.45; margin-bottom: 12px;
}
.tip b { font-size: 13px; }
.privacy { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; max-width: 440px; gap: 24px; }
  .auth-wrap .auth-card { order: -1; }
  .hero-title { font-size: 30px; }
  .features { grid-template-columns: 1fr; }
}

/* ---------- v29: theme button on login, name day, celebrations, avatars, registration ---------- */
.widgets { flex-wrap: wrap; }
.widget.nameday b { font-size: 16px; }
.auth-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }
.auth-links { margin: 14px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; resize: vertical;
}
:root:not([data-theme="dark"]) textarea { background: #fff; }
.celebrate {
  margin-bottom: 12px; padding: 12px 16px; border-radius: 14px; font-weight: 500;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #78350f; border: 1px solid #fcd34d;
}
:root[data-theme="dark"] .celebrate { background: #3a2a10; color: #fde68a; border-color: #5a4318; }
.hero-celebrate {
  margin: -6px 0 14px; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #78350f;
}
:root[data-theme="dark"] .hero-celebrate { background: #3a2a10; color: #fde68a; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; }
.avatar.initials {
  display: inline-grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { margin: 0 0 4px; font-size: 22px; }
.profile-head p { margin: 4px 0 0; }
.sidebar nav a { position: relative; }
.nav-count {
  margin-left: auto; background: #ef4444; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; line-height: 18px;
}
html.collapsed .nav-count { position: absolute; top: 2px; right: 6px; margin: 0; }
.reg-item {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.reg-item:last-child { border-bottom: 0; }
.reg-item .form { align-items: center; }

/* ---------- v30: daily message on the main page ---------- */
.daily-msg {
  display: flex; gap: 14px; align-items: center; margin-bottom: 16px; padding: 16px 20px;
  border-radius: var(--radius); border: 1px solid #fbcfe8;
  background: linear-gradient(135deg, #fce7f3, #fdf2f8 55%, #fef3c7);
}
.daily-msg .dm-ic {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-size: 22px; background: rgba(255, 255, 255, 0.8);
}
.daily-msg small { color: #9d174d; font-size: 12px; font-weight: 600; }
.daily-msg p { margin: 2px 0 0; font-size: 16px; font-weight: 600; line-height: 1.45; color: #3b0a24; }
:root[data-theme="dark"] .daily-msg { background: linear-gradient(135deg, #3a1530, #2a1a2e 60%, #2a2210); border-color: #5b2148; }
:root[data-theme="dark"] .daily-msg .dm-ic { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .daily-msg small { color: #f9a8d4; }
:root[data-theme="dark"] .daily-msg p { color: #fce7f3; }

/* ---------- v31: daily quote on the login page ---------- */
.hero-quote {
  margin: 0 0 16px; padding: 14px 18px; border-radius: 14px; border-left: 4px solid #ec4899;
  background: linear-gradient(135deg, #fce7f3, #fdf2f8 60%, #fef3c7); color: #3b0a24;
  font-size: 15px; font-weight: 600; line-height: 1.5; font-style: italic;
}
.hero-quote span { display: block; font-style: normal; font-size: 12px; color: #9d174d; margin-bottom: 4px; }
:root[data-theme="dark"] .hero-quote { background: linear-gradient(135deg, #3a1530, #2a1a2e 60%, #2a2210); color: #fce7f3; }
:root[data-theme="dark"] .hero-quote span { color: #f9a8d4; }

/* ---------- v33: phone layout: slide-in menu, compact top bar ---------- */
.menu-backdrop { display: none; }
@media (max-width: 800px) {
  body { display: block; }
  .sidebar,
  html.collapsed .sidebar {
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 20px;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 280px; max-width: 85vw; height: 100vh; height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto; transform: translateX(-105%); transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }
  html.menu-open .sidebar { transform: none; }
  .menu-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, 0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
  }
  html.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  html.menu-open body { overflow: hidden; }
  /* inside the drawer everything is shown in full, also if the desktop menu was collapsed */
  .sidebar nav, html.collapsed .sidebar nav { flex-direction: column; flex: 1; }
  html.collapsed .sidebar .lbl, html.collapsed .brand > div { display: flex; }
  html.collapsed .brand > div { display: block; }
  html.collapsed .sidebar nav a, .sidebar nav a { justify-content: flex-start; padding: 12px 14px; }
  html.collapsed .brand { flex-direction: row; justify-content: flex-start; padding: 0 8px; gap: 12px; }
  html.collapsed .user-box a, html.collapsed .logout { justify-content: flex-start; text-align: left; padding: 10px 14px; }
  html.collapsed .nav-count { position: static; margin-left: auto; }
  .brand small, .sidebar nav a.soon { display: revert; }
  .sidebar nav a.soon { display: flex; }
  .menu-toggle.in-sidebar { display: inline-grid; place-items: center; margin-left: auto; }

  /* top bar: menu button + title in one row, widgets in a neat grid below */
  .topbar {
    position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center;
    gap: 10px 12px; padding: calc(14px + env(safe-area-inset-top)) 16px 4px;
  }
  .menu-toggle.mobile-only { display: inline-grid; place-items: center; grid-column: 1; grid-row: 1; }
  .title-block { grid-column: 2; grid-row: 1; min-width: 0; padding-right: 50px; }
  .topbar h1 { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
  .address { font-size: 12px; margin-top: 2px; }
  .topbar .widgets {
    grid-column: 1 / -1; grid-row: 2; margin: 0; width: 100%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .widget { min-width: 0; padding: 8px 12px; }
  .widget b { font-size: 16px; }
  .widget.nameday b { font-size: 14px; }
  .widget small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .view-picker { grid-column: 1 / -1; }
  .view-picker select { width: 100%; }
  .theme-btn { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px;
    width: 42px; height: 42px; font-size: 18px; }

  main { padding: 12px 16px 32px; }
  .box { padding: 16px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px; column-gap: 10px; }
  .card .ic { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
  .card b { font-size: 18px; }
  .card small { font-size: 12px; }
  .form label { flex: 1 1 140px; min-width: 0; }
  .form input, .form select { width: 100%; }
  .form button { flex: 1 1 100%; }
  .daily-msg { padding: 14px; }
  .daily-msg p { font-size: 15px; }
  .box-head { gap: 8px; }
  .tabs { overflow-x: auto; max-width: 100%; }
  .tabs a { white-space: nowrap; }
  .years { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .years a { white-space: nowrap; }
  th, td { padding: 10px 8px; }
  .profile-head { gap: 14px; }
}
@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
}

/* ---------- v35: phone fixes (iPhone screenshots 2026-11-12) ---------- */
@media (max-width: 800px) {
  /* stacked forms (login, register): fields keep their natural height, no big gaps */
  .form.vertical label { flex: 0 0 auto; }
  /* checkbox + text stay together on one line (login "Maradjak bejelentkezve", permissions) */
  .form label.remember, label.remember {
    flex: 0 0 auto; flex-direction: row; align-items: center; gap: 8px; width: auto;
  }
  .form input[type=checkbox], .form input[type=radio], input[type=checkbox] { width: auto; flex: none; }
  .perm-picks { gap: 8px 14px; }
  .perm-picks label.remember { font-size: 13px; }
  /* iPhone date fields are wider than the screen by default */
  input[type=date] {
    -webkit-appearance: none; appearance: none; min-width: 0; width: 100%;
    min-height: 44px; text-align: left;
  }
  /* tables without their own scroll box (e.g. own bank accounts) scroll sideways instead of spilling out */
  .box > table { display: block; overflow-x: auto; max-width: 100%; }
  code { word-break: break-all; }
  small.sub { white-space: normal; }
}

/* ---------- v36: permission ticks in an aligned grid (same column width everywhere) ---------- */
.perm-picks, .form .perm-picks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px;
  align-items: center; width: 100%;
}
.perm-picks .perm-title { grid-column: 1 / -1; font-weight: 600; color: var(--muted); }
.perm-picks label.remember { margin: 0; justify-content: flex-start; white-space: nowrap; }
@media (max-width: 800px) {
  .perm-picks, .form .perm-picks { grid-template-columns: 1fr 1fr; }
}

/* ---------- v37: uniform form fields and buttons everywhere ---------- */
:root { --field-h: 46px; }
.form { align-items: flex-end; gap: 14px 16px; }
.form > label:not(.remember) { flex: 1 1 190px; min-width: 0; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
.form select,
.form textarea {
  box-sizing: border-box; width: 100%; height: var(--field-h); padding: 0 14px;
  border-radius: var(--field-radius, 12px); border: 1px solid var(--line); font: inherit; font-size: 15px; line-height: normal;
  -webkit-appearance: none; appearance: none; margin: 0;
}
.form textarea { height: auto; min-height: 92px; padding: 12px 14px; }
.form select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b93a7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
.form input[type=date] { padding-right: 10px; min-width: 0; }
.form input[type=date]::-webkit-date-and-time-value { text-align: left; }
.form input[type=file] {
  box-sizing: border-box; width: 100%; min-height: var(--field-h); padding: 10px 12px; border-radius: 12px;
  border: 1px dashed var(--line); font-size: 14px;
}
.form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.form select,
.form textarea { background-color: var(--field-bg, #fff); }
/* buttons in forms: same height as the fields, same look (the small grey variant included) */
.form > button, .form > div > button, .form .push-actions button {
  height: var(--field-h); padding: 0 20px; border-radius: 12px; font-size: 15px; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.form > button.small, .form > div > button.small { font-size: 15px; }
.form h2, .form > p, .form > .hint, .form .perm-picks { flex-basis: 100%; }
/* the "Kinek az adatai" picker in the top bar: same style of arrow as the form fields */
.view-picker select {
  -webkit-appearance: none; appearance: none; width: 100%; margin-top: 2px; height: 30px;
  padding: 0 28px 0 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px;
  color: var(--ink); background-color: transparent; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b93a7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 10px 7px;
}
@media (max-width: 800px) {
  .form > label:not(.remember) { flex: 1 1 140px; }
  .form > button, .form > div > button { flex: 1 1 100%; }
}

/* ---------- v38: home page ---------- */
.hello {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px;
  padding: 20px 22px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.25);
}
.hello h2 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.hello p { margin: 0; opacity: 0.9; font-size: 14px; }
.hello .avatar { border: 3px solid rgba(255, 255, 255, 0.6); }
.note-list { display: flex; flex-direction: column; gap: 8px; }
.note {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  text-decoration: none; color: var(--ink); background: var(--accent-soft); transition: transform 0.15s;
}
.note:hover { transform: translateX(3px); }
.note-ic { font-size: 20px; flex: none; }
.note-go { margin-left: auto; color: var(--muted); font-size: 20px; }
.empty-note { margin: 0; color: var(--muted); font-weight: 500; }
.dash-title { margin: 24px 0 12px; }
@media (max-width: 800px) {
  .hello { padding: 16px; }
  .hello h2 { font-size: 21px; }
  .hello .avatar { width: 48px !important; height: 48px !important; }
}

/* v38b: in a vertical (column) form the v37 flex-basis 190px became each label's HEIGHT
   (login, register, profile). Labels there take only their natural height. */
.form.vertical > label, .form.vertical > label:not(.remember) { flex: 0 0 auto; }

/* ---------- v41: several households: neutral app logo, monogram, invite link ---------- */
.auth-logo.app-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink); }
.auth-logo.app-logo svg { width: 84px; height: 84px; max-width: none; filter: drop-shadow(0 8px 18px rgba(99, 102, 241, 0.35)); }
.auth-logo.app-logo b { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.brand-icon.monogram {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 800; font-size: 19px;
}
.invite-link { display: flex; gap: 10px; flex-wrap: wrap; }
.invite-link input {
  flex: 1 1 260px; min-width: 0; height: var(--field-h); padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); font: inherit; font-size: 14px; background: var(--panel); color: var(--ink);
}
.auth-links small { color: var(--muted); font-size: 12px; }

/* ---------- v42: join code, registration choice ---------- */
.join-code { width: 100%; margin: 4px 0 0; font-size: 28px; font-weight: 800; letter-spacing: 0.12em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent, #6366f1); }
.reg-choice { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px;
  background: rgba(99, 102, 241, 0.08); }

/* v43: edit button next to delete, cancel link in forms */
td.actions a.icon-btn { margin-right: 6px; vertical-align: middle; }
.btn-link { align-self: center; color: var(--muted); font-size: 14px; }
form.inline.rename { display: flex; margin-top: 6px; }
form.inline.rename input { width: 150px; }

/* v45: account deletion */
.danger-zone { border-color: #fecaca !important; }
button.danger { background: #dc2626; color: #fff; }
button.danger:hover { background: #b91c1c; }

/* v46: legal pages, accept checkbox */
.legal-body { padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.legal { max-width: 760px; margin: 0 auto; background: var(--panel); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); line-height: 1.6; }
.legal h2 { margin-top: 4px; }
.legal h3 { margin: 22px 0 6px; font-size: 16px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.legal th, .legal td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.accept { font-size: 13px; line-height: 1.45; align-items: flex-start; }
.legal-links { font-size: 12px; margin-top: 6px; }
.legal table { display: table; table-layout: fixed; }
.legal th, .legal td { white-space: normal; overflow-wrap: anywhere; }
.legal th:first-child, .legal td:first-child { width: 42%; }

/* v47: in a vertical form (login, register) the button keeps the field height on phones too
   (the v37 "flex: 1 1 100%" squeezed it into a thin strip in a column) */
.form.vertical > button { flex: 0 0 auto; height: var(--field-h); }
