:root { --bg: #f6f4ef; --card: #fff; --text: #1d1b16; --muted: #837d70; --accent: #d9542b; --line: #e7e2d8; --ok: #2f8a4c; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #16150f; --card: #22211b; --text: #f1ede4; --muted: #9a9486; --accent: #ff7a4d; --line: #34322a; --ok: #5cc97f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* иначе display: flex у классов перебивает hidden */
body.simple .adv { display: none !important; } /* простой режим: только даты и напоминания */
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.4 -apple-system, system-ui, sans-serif;
       padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 96px); }
main { max-width: 520px; margin: 0 auto; }
header { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 34px; margin: 20px 0 16px; }
h2 { font-size: 22px; margin: 0; }
p { margin: 0 0 12px; }
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.hint { border-left: 4px solid var(--accent); }
.stack { display: grid; gap: 12px; }
input, select, textarea, button { font: inherit; color: inherit; width: 100%; padding: 12px; border-radius: 12px;
                                  border: 1px solid var(--line); background: var(--bg); min-height: 48px; }
textarea { resize: vertical; min-height: 72px; }
label.check { display: flex; align-items: center; gap: 10px; }
label.check input { width: 22px; min-height: 22px; accent-color: var(--accent); }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border: 0; font-weight: 600; }
button.plain { border: 0; background: none; color: var(--accent); width: auto; padding: 0 4px; }
button.danger { border: 0; background: none; color: #c0392b; }
.icon { position: relative; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: none;
        color: var(--muted); font-size: 24px; }
.icon .dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.fab { position: fixed; right: max(16px, calc(50% - 244px)); bottom: calc(env(safe-area-inset-bottom) + 20px);
       width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
       font-size: 32px; line-height: 1; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
ul { list-style: none; padding: 0; margin: 0; }
li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
li:last-child { border-bottom: 0; }
ol { margin: 0; padding-left: 20px; }
ol li { display: list-item; padding: 4px 0; border: 0; cursor: default; }
.left { min-width: 56px; text-align: center; font-weight: 700; color: var(--accent); }
.left small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.info small { color: var(--muted); }
.note { display: block; color: var(--muted); font-size: 15px; white-space: pre-line; }
.jubilee { color: var(--accent); font-weight: 600; }
li.past { opacity: .5; }
li.past .left { color: var(--muted); font-weight: 400; font-size: 14px; }
.empty { display: block; color: var(--muted); text-align: center; padding: 8px 0; cursor: default; }
.muted { color: var(--muted); font-size: 15px; }
.ok { color: var(--ok); }
label.check input.pick-edit { width: 100%; min-height: 40px; padding: 8px; }
dialog { width: min(520px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; border: 0; border-radius: 20px 20px 0 0;
         padding: 0; background: var(--card); color: var(--text); }
dialog > * { padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.tabs button { width: auto; min-height: 40px; padding: 8px 16px; border: 0; border-radius: 20px;
               background: var(--card); white-space: nowrap; }
.tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.tabs .new { color: var(--accent); }
.tabs::-webkit-scrollbar { display: none; }
/* Лента списков: правый край тает, если вкладки не помещаются; отступ — чтобы последняя вкладка докручивалась целиком. */
#tabs, #tagBar { padding-right: 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
                 mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
/* Разделы — три равные кнопки, всегда на экране: в общей ленте «Задачи» на айфоне уезжали за край. */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.actions button { min-height: 44px; padding: 8px 2px; border: 0; border-radius: 14px; background: var(--card); color: var(--accent);
                  white-space: nowrap; font-size: clamp(13px, 3.9vw, 16px); }
#kinds { flex-wrap: wrap; gap: 6px; margin: 0; }
#kinds button { background: var(--bg); padding: 8px 10px; }
#kinds button[aria-pressed="true"] { background: var(--text); }
.groupbar { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: -4px 0 12px; }
.badge { color: var(--accent); font-size: 13px; }
.wish-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wish-grid li { position: relative; display: block; padding: 0; overflow: hidden; border: 1px solid var(--line);
                border-radius: 16px; background: var(--bg); cursor: default; }
.wish-grid .empty { grid-column: 1 / -1; padding: 20px; border: 0; }
.wish-grid .wish-year { padding: 4px 0 0; font-weight: 600; background: none; text-align: left; }
.wish-media { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden;
              background: color-mix(in srgb, var(--line) 55%, var(--card)); font-size: 42px; }
.wish-media img { width: 100%; height: 100%; object-fit: cover; }
.wish-body { display: grid; gap: 6px; padding: 10px; }
.wish-name { display: -webkit-box; min-height: 2.8em; overflow: hidden; font-weight: 600; color: var(--text);
             text-decoration: none; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.wish-price { font-weight: 700; }
a.button { display: block; text-align: center; padding: 12px; border-radius: 12px; min-height: 48px; text-decoration: none; }
a.button.primary { background: var(--accent); color: #fff; font-weight: 600; }
li.month { display: block; border: 0; padding: 14px 0 2px; cursor: default; color: var(--muted); font-size: 13px;
           font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.undo { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 92px);
        width: min(488px, calc(100vw - 32px)); display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); z-index: 5; }
.undo button { width: auto; min-height: 0; padding: 4px 8px; border: 0; background: none; color: var(--accent); font-weight: 700; }
.wish-top { color: var(--accent); font-size: 13px; font-weight: 600; }
.wish-card button { min-height: 40px; padding: 8px; }
.wish-card.owner { cursor: pointer; }
.wish-card.taken .wish-media { opacity: .35; }
.wish-lock { font-weight: 600; font-size: 14px; color: var(--muted); }
a.wish-media { text-decoration: none; }
.wish-card a.button { min-height: 40px; padding: 8px; border: 1px solid var(--line); color: var(--accent); font-weight: 600; }
.wish-mine { color: var(--ok); font-weight: 600; font-size: 14px; }
.wish-preview { width: 140px; aspect-ratio: 1; margin: auto; border-radius: 16px; overflow: hidden; }
details summary { color: var(--accent); cursor: pointer; padding: 8px 0; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 12px; }
