:root {
    --bg: #10170b; --bg2: #16200f; --card: rgba(255,255,255,.06); --line: rgba(255,255,255,.17);
    --ink: #f3f7ea; --muted: #b3c19b; --accent: #a3e635; --accent-ink: #1a2e05; --field: rgba(255,255,255,.08);
    --warn: #fb923c; color-scheme: dark;
}
@media (prefers-color-scheme: light) {
    :root { --bg: #f6f9ef; --bg2: #ecf3dc; --card: #fff; --line: #cfdcb4; --ink: #1c2a0c; --muted: #55663a;
            --accent: #4d7c0f; --accent-ink: #fff; --field: #f4f8ea; --warn: #b45309; color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f6f9ef; --bg2: #ecf3dc; --card: #fff; --line: #cfdcb4; --ink: #1c2a0c; --muted: #55663a;
            --accent: #4d7c0f; --accent-ink: #fff; --field: #f4f8ea; --warn: #b45309; color-scheme: light; }
:root[data-theme="dark"] { --bg: #10170b; --bg2: #16200f; --card: rgba(255,255,255,.06); --line: rgba(255,255,255,.17);
            --ink: #f3f7ea; --muted: #b3c19b; --accent: #a3e635; --accent-ink: #1a2e05; --field: rgba(255,255,255,.08); --warn: #fb923c; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: clamp(1rem,4vw,2.5rem) 1rem 4rem; display: flex; justify-content: center;
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
       background: linear-gradient(180deg, var(--bg), var(--bg2)) fixed; touch-action: manipulation; }
.app { width: min(520px, 100%); min-width: 0; }
header { text-align: center; margin-bottom: 1.1rem; }
h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.02em; }
.sub { margin: .3rem 0 0; color: var(--muted); font-size: 1rem; font-weight: 400; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem; margin-bottom: .9rem; }
label, .big-label { display: block; margin: .9rem 0 .35rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
.f label { margin-top: .6rem; }
.opt { font-weight: 400; }
input[type=text] { width: 100%; min-width: 0; min-height: 46px; padding: .5rem .7rem; font: inherit; font-size: 1.05rem; color: var(--ink);
       background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tabs { display: grid; gap: .4rem; margin-bottom: .4rem; }
.tabs.two { grid-template-columns: 1fr 1fr; }
.tabs button, .chips button { min-height: 44px; padding: 0 .6rem; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; }
.tabs button[aria-pressed="true"], .chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .4rem; }
.hint { margin: .4rem 0 0; color: var(--muted); font-size: .88rem; }
.rooms { list-style: none; margin: 0 0 .7rem; padding: 0; display: grid; gap: .9rem; }
.room { background: var(--card); border: 2px solid var(--line); border-left: 6px solid var(--accent); border-radius: 16px; padding: .9rem; min-width: 0; }
.room-head { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: .4rem; margin-bottom: .2rem; }
.room-head input { font-weight: 700; }
.x { border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font-size: 1.3rem; cursor: pointer; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.f { min-width: 0; }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: .3rem; }
.stepper button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font-size: 1.3rem; cursor: pointer; padding: 0; }
.stepper input { text-align: center; padding: .5rem .2rem; }
.surf { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.1rem; margin-top: .7rem; }
.surf-l { font-size: .9rem; font-weight: 600; color: var(--muted); }
label.check { display: flex; align-items: center; gap: .4rem; margin: 0; min-height: 44px; color: var(--ink); font-weight: 600; font-size: 1rem; }
label.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.sizes { margin-top: .5rem; }
.addmail { display: block; min-height: 40px; padding: 0 .2rem; border: 0; background: none; color: var(--accent); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; text-align: left; }
.room-note { margin: .5rem 0 0; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.room-note.warn { color: var(--warn); font-weight: 600; }
.ghost { width: 100%; min-height: 46px; border-radius: 12px; border: 2px dashed var(--line); background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.newbill { margin: .6rem 0 0; text-align: center; color: var(--muted); font-size: .9rem; }
.newbill .addmail { display: inline; }
.big { font-size: clamp(1.5rem, 7vw, 2rem); font-weight: 800; letter-spacing: -.01em; color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.tin { padding: .8rem .9rem; margin-bottom: .6rem; border-radius: 14px; background: var(--field); border-left: 6px solid var(--accent); }
.tin-name { font-weight: 700; overflow-wrap: anywhere; }
.meta { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.none { color: var(--muted); margin: 0 0 .5rem; }
h3 { margin: 1.1rem 0 .4rem; font-size: 1rem; }
.roomsum { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.roomsum li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .7rem; background: var(--field); border-radius: 10px; font-size: .92rem; font-variant-numeric: tabular-nums; }
.roomsum li span:first-child { font-weight: 600; overflow-wrap: anywhere; }
.roomsum li span:last-child { text-align: right; color: var(--muted); }
.mail { display: grid; gap: .5rem; margin: 1rem 0 .3rem; }
.primary { width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }
a.primary { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; padding: .5rem; }
.primary.alt { background: transparent; color: var(--ink); border: 1px solid var(--accent); }
.msg { min-height: 1.4em; margin: .3rem 0 0; text-align: center; color: var(--muted); font-size: .9rem; }
.faq h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
details { border-top: 1px solid var(--line); padding: .6rem 0; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details p { margin: .4rem 0 0; color: var(--muted); }
footer { text-align: center; margin-top: 1.5rem; font-size: .9rem; } footer a { color: var(--muted); }
[hidden] { display: none !important; }
@media (max-width: 380px) { .grid3 { gap: .35rem; } .room { padding: .7rem; } .grid2 { grid-template-columns: 1fr 1fr; } }

/* back to the list of all apps */
.back { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; margin: 0 0 .5rem; padding: 0 1rem 0 .8rem; border: 1px solid var(--line, rgba(127,127,127,.4)); border-radius: 999px; color: var(--muted, var(--mut, inherit)); font-size: .92rem; font-weight: 600; text-decoration: none; background: transparent; }
.back:hover { color: var(--ink, inherit); border-color: currentColor; }
.back:focus-visible { outline: 3px solid var(--accent, var(--acc, #fff)); outline-offset: 2px; }
@media print { .back, .inputs, .mail, .faq, footer, .msg, .hint { display: none !important; } body { background: #fff; color: #000; } .card { border: 0; } .big, .tin-name { color: #000; } }

/* laptops and desktops: rooms on the left, shopping list on the right */
@media (min-width: 900px) {
    .app { width: min(1100px, 100%); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 1.5rem; align-items: start; }
    .app > * { grid-column: 1 / -1; }
    .app > .inputs { grid-column: 1; min-width: 0; }
    .app > .result { grid-column: 2; margin-top: 0; }
    .app > .faq, .app > footer { width: min(760px, 100%); justify-self: center; }
    header h1 { font-size: 2.3rem; }
    .rooms { grid-template-columns: 1fr; }
}
