/* Tally Books additions on top of the shared hub styles (app.css, copied from Tally Up). */
.navbtn .count { font-size: 11.5px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
.navbtn .count.soft { background: var(--side-hover); color: var(--side-ink); }
.navbtn .ic { width: 18px; text-align: center; opacity: .8; }
.navbtn .lbl { flex: 1; display: flex; gap: 9px; align-items: center; }
.navbtn .short { display: none; }

.drop { border: 2px dashed var(--line-strong); border-radius: 18px; background: var(--panel); padding: 26px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 16px; margin-bottom: 4px; }
#dropcover { position: fixed; inset: 0; background: rgba(123,108,240,.18); z-index: 90; display: grid; place-items: center; pointer-events: none; }
#dropcover div { background: #fff; border: 2px dashed var(--accent); border-radius: 18px; padding: 28px 40px; font-size: 18px; font-weight: 650; color: var(--ink); box-shadow: var(--shadow); }
#dropcover[hidden] { display: none; }

.steps { display: grid; gap: 10px; }
.stepline { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.stepline .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent); flex: none; }
.stepline.done .num { background: var(--ok-bg); color: var(--ok); }
.stepline .grow { min-width: 0; }

/* review */
.review { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.qlist { display: grid; gap: 6px; max-height: calc(100vh - 170px); overflow-y: auto; padding-right: 4px; }
.qitem { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 11px; cursor: pointer; display: grid; gap: 2px; }
.qitem:hover { border-color: var(--line-strong); }
.qitem.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123,108,240,.16); }
.qitem .v { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .m { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.editor { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; }
.thumb { background: var(--hover); border-radius: 12px; min-height: 260px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; }
.thumb img { width: 100%; display: block; }
.thumb .faint { padding: 20px; text-align: center; }
.readnotes { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; padding-left: 18px; }
.conf { font-size: 11.5px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.subtabs { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.subtabs .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
table.t td.pad { padding: 8px 8px; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--hover); }
table.t tfoot td { font-weight: 700; padding: 9px 8px; border-top: 1px solid var(--line-strong); }
.tile.lav { background: var(--t-lav); border-color: transparent; }
.tile.mint { background: var(--t-mint); border-color: transparent; }
.tile.peach { background: var(--t-peach); border-color: transparent; }
.tile.butter { background: var(--t-butter); border-color: transparent; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hero .rb-slot { width: 96px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .in, .toolbar .sel { width: auto; }
@media (max-width: 1150px) { .editor { grid-template-columns: 1fr; } .thumb { min-height: 160px; max-height: 300px; } }
.editor .formgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#app.nosidebar { grid-template-columns: 1fr; }
#app.nosidebar .side { display: none; }

/* ---------- web app: receipt viewer, add button, phone layout ---------- */
.viewer .modal { width: min(820px, 96vw); }
.fab { display: none; }
@media (max-width: 760px) {
  body { font-size: 15px; }
  #app { display: block; height: auto; min-height: 100vh; }
  main { overflow: visible; }
  .page { padding: calc(14px + env(safe-area-inset-top)) 14px calc(110px + env(safe-area-inset-bottom)); }
  h1 { font-size: 22px; }
  /* the sidebar becomes a tab bar at the bottom */
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-direction: row; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: rgba(239,235,252,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow-x: auto; }
  .side .brand, .side .spacer, .side .tool, .side .folder, .side .label { display: none; }
  .navbtn .long { display: none; }
  .navbtn .short { display: inline; }
  .navbtn { width: auto; flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 4px; font-size: 10.5px; text-align: center; position: relative; }
  .navbtn .lbl { flex-direction: column; gap: 1px; align-items: center; }
  .navbtn .ic { font-size: 17px; width: auto; }
  .navbtn.active { box-shadow: none; background: #fff; }
  .navbtn .count { position: absolute; top: 2px; right: 6px; font-size: 10px; padding: 0 5px; min-width: 16px; }
  #app.nosidebar .side { display: none; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 45; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 32px; line-height: 1; box-shadow: 0 8px 22px rgba(123,108,240,.45); cursor: pointer; }
  body:has(#app.nosidebar) .fab, body:has(.scrim) .fab { display: none; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); }
  /* bigger touch targets, and 16px text so iPhone does not zoom into fields */
  .in, .sel, textarea.in { font-size: 16px; padding: 9px 10px; }
  .btn { padding: 9px 14px; }
  .btn.small { padding: 7px 11px; font-size: 13px; }
  .row.between { flex-wrap: wrap; gap: 10px; }
  .hero { padding: 16px; gap: 12px; }
  .hero .rb-slot { width: 64px !important; }
  .hero h1 { font-size: 21px; }
  .bubble { font-size: 14px; }
  .grid.cols2, .grid.cols3 { grid-template-columns: 1fr; }
  .grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile .v { font-size: 18px; }
  .drop { padding: 18px; }
  /* review: the list becomes a strip of cards across the top */
  .review { grid-template-columns: 1fr; }
  .qlist { display: flex; overflow-x: auto; max-height: none; padding: 2px 2px 8px; gap: 8px; scroll-snap-type: x mandatory; }
  .qitem { min-width: 190px; scroll-snap-align: start; }
  .editor { grid-template-columns: 1fr; gap: 12px; }
  .thumb { min-height: 140px; max-height: 260px; }
  .card { padding: 14px; }
  .editor .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer { width: 100vw; padding: calc(16px + env(safe-area-inset-top)) 14px 40px; }
  .scrim.center { padding-top: env(safe-area-inset-top); }
  .modal { width: 100vw; max-height: 100vh; border-radius: 0; padding: 14px; }
  .tablewrap table.t { min-width: 640px; }
  .toolbar .search { max-width: none; flex: 1; }
  .subtabs { overflow-x: auto; flex-wrap: nowrap; }
}
.aichips .btn { white-space: normal; text-align: left; }

/* Account and installing (web app) */
.modal.acct { width: min(460px, 94vw); }
.modal.acct form { display: flex; flex-direction: column; gap: 12px; }
.modal.acct h2 { margin: 0; }
.modal.acct p { margin: 0; }
.howto { margin: 6px 0 0; padding-left: 22px; line-height: 1.7; }
.card.install { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--panel) 70%); }
.card.install h2 { margin: 0; }
@media (max-width: 760px) { .modal.acct { width: 100vw; min-height: 100vh; padding-top: calc(22px + env(safe-area-inset-top)); } }

/* Wide tables (Reports) scroll sideways inside their card on phones, instead of pushing the page wider. */
@media (max-width: 760px) {
  .card:has(> table.t) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card > table.t { font-size: 13px; }
  .card > table.t th, .card > table.t td { white-space: nowrap; }
  .card > table.t td:nth-child(2) { white-space: normal; min-width: 120px; }
}
