:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d2320; --muted: #66706b; --line: #e6e4dd;
  --brand: #146b4f; --brand-2: #1f8a66; --brand-soft: #e3f2ec; --accent: #ff8a3d;
  --warn: #b54708; --warn-soft: #fff1e6; --bad: #c4292f; --bad-soft: #fdecec; --ok: #1f8a66; --ok-soft: #e6f5ee;
  --radius: 16px; --shadow: 0 1px 2px rgba(20,30,25,.06), 0 4px 16px rgba(20,30,25,.05);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --card: #1a201d; --ink: #eef2ef; --muted: #9aa49f; --line: #2a322e;
    --brand: #3fbf90; --brand-2: #5fd3a8; --brand-soft: #173328; --warn: #f5a35b; --warn-soft: #33241a; --bad: #ff7b7f; --bad-soft: #3a1f21;
    --ok: #5fd3a8; --ok-soft: #173328; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.hidden { display: none !important; }

/* Shell */
.trialbar { background: #fff3c4; color: #5b4500; font-size: .82rem; text-align: center; padding: 6px 12px; }
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; padding: 20px 14px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow: auto; background: var(--card); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; margin: 0 8px 18px; }
.logo img { width: 32px; height: 32px; border-radius: 9px; }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.side a.nav:hover { background: var(--bg); }
.side a.nav.on { background: var(--brand-soft); color: var(--brand); }
.side .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.ico { width: 22px; text-align: center; font-size: 1.1rem; }
main { flex: 1; min-width: 0; padding: 24px 28px 100px; max-width: 980px; }
.top h1 { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top .hh { font-weight: 700; }
.bottomnav { display: none; }

@media (max-width: 820px) {
  .side { display: none; }
  main { padding: 14px 16px calc(var(--nav-h) + 90px); }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; }
  .bottomnav a .ico { font-size: 1.3rem; }
  .bottomnav a.on { color: var(--brand); }
  h1 { font-size: 1.35rem; }
}

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.tight { padding: 6px 0; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; gap: 0; } }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.card.tight .row:first-of-type, .card.tight h2 + .row { border-top: 0; }
.card.tight h2 { padding: 8px 16px 4px; margin: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.emoji { width: 38px; height: 38px; border-radius: 11px; background: var(--bg); display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.empty { text-align: center; color: var(--muted); padding: 22px 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: .8rem; flex: none; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--brand); color: #fff; min-height: 42px; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.small { padding: 6px 11px; min-height: 34px; font-size: .86rem; border-radius: 10px; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.iconbtn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); font-size: 1rem; }
.iconbtn:hover { background: var(--bg); }
label.f { display: block; margin: 0 0 12px; font-weight: 600; font-size: .9rem; }
label.f > span.h { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 2px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .fields2 { grid-template-columns: 1fr; } }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: transparent; cursor: pointer; flex: none; display: grid; place-items: center; color: transparent; transition: .15s; }
.check:hover { border-color: var(--brand); }
.check.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.done .title { text-decoration: line-through; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg { display: inline-flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.err { color: var(--bad); font-weight: 600; font-size: .9rem; min-height: 1.2em; margin: 4px 0 8px; }

/* Quick add */
.quick { display: flex; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); margin-bottom: 6px; }
.quick input { border: 0; margin: 0; padding: 8px 0; min-height: 40px; background: transparent; }
.quick input:focus { outline: none; }
.quickhint { font-size: .8rem; color: var(--muted); margin: 0 4px 14px; min-height: 1.2em; }

/* Hero / banners */
.hello { margin: 4px 0 14px; }
.hello h1 { margin: 0; }
.banner { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; font-weight: 700; }
.banner.bin { background: #263238; color: #fff; }
.banner.alert { background: var(--bad-soft); color: var(--bad); }
.banner .big { font-size: 1.6rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.4rem; }
.stat span { font-size: .8rem; color: var(--muted); }

/* Ads */
.ad { position: relative; display: flex; gap: 12px; align-items: center; border: 1px dashed #c9c5b8; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(0,0,0,.015) 12px 24px), var(--card); text-decoration: none; color: var(--ink); }
.ad .adlabel { position: absolute; top: 6px; right: 10px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.ad .adimg { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.ad .adtxt { flex: 1; min-width: 0; }
.ad .adtxt b { display: block; }
.ad .adx { font-size: .78rem; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .day { min-height: 74px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); padding: 5px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal .day.out { opacity: .45; }
.cal .day.today .n { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; }
.cal .day.sel { outline: 2px solid var(--brand); }
.cal .n { font-weight: 700; font-size: .85rem; align-self: flex-start; }
.cal .ev { font-size: .7rem; line-height: 1.25; border-radius: 6px; padding: 1px 5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .more { font-size: .68rem; color: var(--muted); font-weight: 700; }
@media (max-width: 620px) {
  .cal .day { min-height: 54px; padding: 4px; align-items: center; }
  .cal .ev { display: none; }
  .cal .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
  .cal .more { display: none; }
}
@media (min-width: 621px) { .cal .dots { display: none; } }
.cal .dots .dot { width: 6px; height: 6px; }
.calhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.calhead .m { font-weight: 800; font-size: 1.15rem; min-width: 150px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--muted); margin: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.timecol { width: 64px; flex: none; font-weight: 700; font-size: .85rem; }

/* Sheets (modals) */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,15,12,.45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@media (min-width: 821px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet .shead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet .shead h2 { margin: 0; }
.sheet .actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.sheet .actions .btn { flex: 1; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%); background: #1d2320; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
@media (min-width: 821px) { .toast { bottom: 28px; } }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 820px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; }
.plan.pop { border-color: var(--brand); position: relative; }
.plan.pop::before { content: "Most popular"; position: absolute; top: -12px; left: 16px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.plan .price { font-size: 1.9rem; font-weight: 800; margin: 4px 0; }
.plan .price small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.plan ul { padding: 0; margin: 10px 0 16px; list-style: none; flex: 1; }
.plan li { padding: 4px 0 4px 24px; position: relative; font-size: .92rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 800; }
.plan li.no { color: var(--muted); } .plan li.no::before { content: "–"; color: var(--muted); }
.meter { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.locked { position: relative; overflow: hidden; }
.locked .blur { filter: blur(4px); pointer-events: none; user-select: none; opacity: .7; }
.locked .over { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: linear-gradient(transparent, var(--card) 60%); }

/* Wizard */
.wiz { max-width: 620px; margin: 0 auto; }
.wiz .stepbar { display: flex; gap: 6px; margin: 6px 0 18px; }
.wiz .stepbar i { flex: 1; height: 6px; border-radius: 9px; background: var(--line); }
.wiz .stepbar i.on { background: var(--brand); }
.wiz .big { font-size: 2.6rem; }
.wiz .nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 14px; }
.person { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.person label.f { margin-bottom: 8px; }
.binrow { display: grid; grid-template-columns: 1.2fr 1fr .9fr; gap: 8px; align-items: end; }
@media (max-width: 520px) { .binrow { grid-template-columns: 1fr 1fr; } .binrow .lab { grid-column: 1 / -1; } }
.celebrate { text-align: center; padding: 26px 10px; }
.celebrate .big { font-size: 3.4rem; }

/* Auth */
.auth { max-width: 420px; margin: 7vh auto; padding: 0 16px; }
.auth .logo { justify-content: center; margin-bottom: 20px; font-size: 1.5rem; }
.linkish { background: none; border: 0; color: var(--brand); font-weight: 700; cursor: pointer; padding: 0; }
.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--bg); margin: 8px 0; }
.bar i { display: block; height: 100%; }
