/* Gift Tracker, look A "Cozy": warm paper, pine green and cranberry, gift-tag cards. */
:root {
  --paper: #f6efe3;
  --card: #fffaf1;
  --line: #e3d5bd;
  --dash: #c9b79a;
  --pine: #24563f;
  --pine-dark: #1b4231;
  --berry: #a8322d;
  --gold: #f1c75b;
  --mint: #e4efe7;
  --ink: #2d2a24;
  --muted: #74654e;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; }
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 150px; }
h1, h2, h3 { font-family: var(--serif); color: var(--pine); line-height: 1.2; margin: 0; }
h1 { font-size: 27px; }
h2 { font-size: 21px; margin: 22px 0 10px; }
h3 { font-size: 17px; margin: 16px 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--pine); }
.muted { color: var(--muted); font-size: 14px; }
.loading { text-align: center; color: var(--muted); margin-top: 40vh; }
.hidden { display: none !important; }

/* header */
.top { text-align: center; padding-bottom: 14px; border-bottom: 2px dashed var(--dash); margin-bottom: 12px; }
.top .meta { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pill { display: inline-block; margin-top: 10px; background: var(--berry); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 99px; }
.pill.calm { background: var(--pine); }
.banner { background: var(--mint); border: 1px solid #c4dccb; color: var(--pine-dark); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.banner.warn { background: #fbeae6; border-color: #e7bdb5; color: #7d2420; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.tabs button { flex: 0 0 auto; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 10px; font: 600 15px var(--sans); color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--pine); border-bottom-color: var(--berry); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px 18px 6px 6px; margin-bottom: 10px; position: relative; }
.card::before { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--dash); }
.card.need { border-left: 5px solid var(--berry); }
.card.done > .head { opacity: .6; }
.card .head { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 13px 30px 13px 14px; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.card .name { flex: 1; font-family: var(--serif); font-size: 18px; font-weight: 700; }
.card .name small { display: block; font-family: var(--sans); font-size: 12px; font-weight: 400; color: var(--muted); }
.card .body { border-top: 1px dashed var(--line); padding: 10px 14px 14px; font-size: 15px; }
.boxes { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.boxes i { width: 17px; height: 15px; border-radius: 2px; background: var(--berry) linear-gradient(90deg, transparent 7px, var(--gold) 7px, var(--gold) 10px, transparent 10px); }
.boxes i.off { background: transparent; border: 1.5px dashed var(--dash); }
.boxes i.extra { background-color: #c77b3c; }
.count { font-weight: 700; color: var(--muted); font-size: 14px; }

.list { list-style: none; margin: 0 0 8px; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #efe4d0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .price { color: var(--muted); white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--mint); color: var(--pine); white-space: nowrap; }
.tag.berry { background: #fbeae6; color: var(--berry); }
.tag.gray { background: #eee7da; color: var(--muted); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; }

/* buttons */
button, .btn { font: 600 15px var(--sans); border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent; }
.btn-main { background: var(--pine); color: #fff; }
.btn-main:hover { background: var(--pine-dark); }
.btn-soft { background: var(--card); color: var(--pine); border-color: var(--line); }
.btn-soft:hover { border-color: var(--dash); }
.btn-danger { background: #fff; color: var(--berry); border-color: #e7bdb5; }
.btn-link { background: none; border: 0; padding: 4px 6px; color: var(--pine); text-decoration: underline; font-weight: 600; font-size: 14px; }
.btn-link.danger { color: var(--berry); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); width: min(528px, calc(100% - 32px)); padding: 15px; font-family: var(--serif); font-size: 18px; box-shadow: 0 6px 18px rgba(36, 86, 63, .35); z-index: 5; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* forms */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
label.field { display: block; margin-bottom: 12px; font-weight: 600; font-size: 15px; }
label.field span.hint { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=tel], select {
  display: block; width: 100%; margin-top: 4px; font: 16px var(--sans); padding: 10px 12px; border: 1px solid var(--dash); border-radius: 9px; background: #fff; color: var(--ink);
}
input:disabled, select:disabled { background: #f1ebe0; color: var(--muted); }
.pin { letter-spacing: .5em; font-size: 22px !important; text-align: center; max-width: 200px; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 15px; }
label.check input { width: 20px; height: 20px; margin-top: 1px; flex: 0 0 auto; accent-color: var(--pine); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.err { color: var(--berry); font-size: 14px; font-weight: 600; min-height: 1em; margin: 4px 0 8px; }
.warnline { color: #8a4b12; background: #fdf1df; border-radius: 8px; padding: 6px 10px; font-size: 14px; margin-bottom: 10px; }

/* sign in names */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.names button { background: var(--card); border: 1px solid var(--line); border-radius: 6px 14px 6px 6px; padding: 14px 10px; font-family: var(--serif); font-size: 17px; color: var(--ink); }
.names button:hover { border-color: var(--pine); }

/* recovery code */
.code { font: 700 24px ui-monospace, Consolas, monospace; letter-spacing: .08em; text-align: center; background: #fff; border: 2px dashed var(--berry); border-radius: 10px; padding: 14px; margin: 10px 0; user-select: all; }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(500px, calc(100% - 24px)); max-height: calc(100% - 40px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(30, 25, 15, .45); }
dialog .dbody { padding: 18px 18px 16px; }
dialog h2 { margin-top: 0; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { text-align: center; margin-top: 28px; font-size: 14px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 20px 10px; }
.stat { font-family: var(--serif); font-size: 18px; margin-bottom: 8px; }

/* spending per person */
.card .money { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.card .money.over { color: var(--berry); }
.card .mbar { display: block; height: 5px; max-width: 180px; background: #efe4d0; border-radius: 99px; margin-top: 4px; overflow: hidden; }
.card .mbar i { display: block; height: 100%; background: var(--pine); border-radius: 99px; }
#toast { width: max-content; }
.two { align-items: end; }
