/* Paprwork.
   Built for a man on a phone in a cabin: big rows, nothing fiddly, legible in
   the dark. Works at 320px and scales up to a desk. */

:root {
  --ink: #16202c;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #d9d3c9;
  --navy: #1f3a5f;
  --rust: #8c4a1e;
  --muted: #5d6673;
  --good: #1f6b43;
  --warn: #8a5a00;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9e5dd;
    --paper: #0f1720;
    --card: #17212c;
    --line: #2c3a49;
    --navy: #9dc0e8;
    --rust: #e0a071;
    --muted: #9aa6b4;
    --good: #6fcf97;
    --warn: #e0b35c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 3rem;
}

header {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy);
  color: #fff;
  padding: env(safe-area-inset-top) 0 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
@media (prefers-color-scheme: dark) { header { background: #15212e; } }
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1rem;
}
.bar select {
  font-size: 1.05rem; font-weight: 600;
  background: transparent; color: inherit;
  border: 0; border-bottom: 1px solid rgba(255,255,255,.35);
  padding: .15rem 0; max-width: 60vw;
}
.bar select option { color: #16202c; }
.period { font-size: .82rem; opacity: .85; margin-top: .2rem; }
.totals { text-align: right; line-height: 1; }
.totals .hours { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }

.state { font-size: .78rem; padding: .35rem 1rem; background: rgba(0,0,0,.18); }
.state[data-state="synced"]  { color: #bfe9cf; }
.state[data-state="queued"]  { color: #ffdca8; }
.state[data-state="saving"]  { color: #d6e7f7; }
.state[data-state="local"]   { color: #e6e6e6; }
.state[data-state="error"]   { color: #ffc2b8; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.card h2 {
  margin: 0 0 .2rem; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
}
.hint { margin: .1rem 0 .8rem; font-size: .86rem; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.grid .wide { grid-column: 1 / -1; }
label { display: block; font-size: .75rem; color: var(--muted); }
select, input, button, textarea {
  font: inherit; width: 100%;
  margin-top: .22rem; padding: .62rem .55rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  min-height: 44px;            /* a thumb, not a cursor */
}
input[type="number"] { font-variant-numeric: tabular-nums; }
button {
  margin-top: .8rem; font-weight: 600; cursor: pointer;
  background: var(--card); border-color: var(--line);
}
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary { color: #0f1720; } }
.actions { display: flex; gap: .6rem; }
.actions button { flex: 1; }

/* days */
.days { margin: 0 -.35rem; }
.day {
  display: grid; grid-template-columns: 4.4rem 5.4rem 1fr;
  gap: .45rem; align-items: center;
  padding: .3rem .35rem; border-top: 1px solid var(--line);
}
.day:first-child { border-top: 0; }
.day.worked { background: color-mix(in srgb, var(--navy) 7%, transparent); }
.day.weekend .dow { color: var(--rust); }
.day .when { line-height: 1.15; }
.day .dom { font-weight: 600; font-variant-numeric: tabular-nums; }
.day .dow { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.day select { margin-top: 0; padding: .45rem .35rem; min-height: 40px; }
.day select.act { font-size: .82rem; }

/* expenses */
.item { border-top: 1px solid var(--line); padding: .7rem .1rem; }
.item:first-child { border-top: 0; }
.item .row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.item .row.one { grid-template-columns: 1fr; }
.item .drop { margin-top: .5rem; }
.item .drop button { margin: 0; color: var(--rust); border-color: transparent; background: transparent; text-align: left; padding-left: 0; }
.empty { color: var(--muted); font-size: .88rem; padding: .4rem 0; }

.checks { margin: .2rem 0 .8rem; padding-left: 1.1rem; font-size: .9rem; }
.checks li { margin: .22rem 0; }
.checks li.ok { color: var(--good); list-style: none; margin-left: -1.1rem; }
.checks li.ok::before { content: "\2713\00a0"; }
.checks li.todo { color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%) translateY(2rem);
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; border-radius: 999px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 620px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .day { grid-template-columns: 5rem 6rem 1fr; }
}

/* receipts */
.receipts {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end;
  margin-top: .6rem;
}
.receipts figure {
  position: relative; margin: 0; width: 74px;
}
.receipts img {
  width: 74px; height: 92px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 6px; display: block;
  background: var(--paper);
}
.receipts figcaption {
  font-size: .62rem; color: var(--muted); text-align: center;
  margin-top: .15rem; line-height: 1.2;
}
.receipts .x {
  position: absolute; top: -7px; right: -7px;
  width: 24px; height: 24px; min-height: 24px; padding: 0; margin: 0;
  border-radius: 50%; line-height: 1;
  background: var(--ink); color: var(--paper); border: 0;
  font-size: .95rem;
}
.receipts .shoot {
  margin: 0; width: auto; flex: 1 1 10rem; min-width: 10rem;
  border-style: dashed; color: var(--navy);
}
@media (prefers-color-scheme: dark) { .receipts .shoot { color: var(--navy); } }

.provenance { display: block; margin-top: .35rem; font-size: .74rem; color: var(--muted); }
/* a class that sets display must never beat the hidden attribute */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#pdLookup { margin-top: 0; }

/* sign-in */
.signin {
  position: fixed; inset: 0; z-index: 30;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.signin .card { width: 100%; max-width: 380px; }
.signout {
  background: none; border: 0; color: inherit; opacity: .75;
  font-size: .72rem; text-decoration: underline; cursor: pointer;
  padding: 0; margin: .2rem 0 0; min-height: 0; width: auto;
}

.vchoice {
  border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .7rem; margin: .5rem 0; font-size: .92rem;
}

/* the converted figure is told, not asked */
.item .usd { opacity: .75; pointer-events: none; }

/* Whose month, and why it came back: above everything, because both change
 * what the reader should do next. */
.banner {
  margin: 0 0 1rem; padding: 10px 14px;
  border: 1px solid var(--warn); border-radius: var(--radius);
  background: var(--card); color: var(--warn); font-weight: 600;
}
.banner p { margin: 0; }
.banner p + p { margin-top: 6px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary h2 { display: inline; }
details.card > summary::-webkit-details-marker { display: none; }
textarea { width: 100%; resize: vertical; font: inherit; }

.btnlink {
  display: inline-block; padding: .55rem .9rem; border: 1px solid var(--line);
  border-radius: 8px; color: var(--navy); text-decoration: none; font-weight: 600;
}
.invnum { border-top: 1px solid var(--line); padding-top: .6rem; margin-bottom: .6rem; }
.record { border-top: 1px solid var(--line); padding: .6rem 0; }
.record .rechead { font-weight: 600; margin-bottom: .3rem; }
.record a { display: inline-block; margin: .2rem .8rem .2rem 0; color: var(--navy); font-size: .9rem; }

/* the app's own question box: the page stays visible behind it */
.signin.dialog { background: rgba(10, 16, 24, .55); backdrop-filter: blur(2px); }
.dialog .card { max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.dialog .card input[type=text] { width: 100%; margin: .2rem 0 .6rem; }
.dialog .actions { margin-top: .4rem; }
button.danger { background: var(--rust); border-color: var(--rust); }
.signin .remember { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.signin .remember input { width: auto; margin: 0; }

/* worker tabs, under the header so they stay in reach */
.wtabs {
  display: flex; gap: .25rem; overflow-x: auto; padding: 0 .6rem .5rem; scrollbar-width: none;
  max-width: 760px; margin: 0 auto;      /* the width of the cards below, not the whole screen */
}
.wtabs button {
  /* five across on a 375px phone: share the row, never stretch to full width */
  flex: 1 1 0; width: auto; min-width: 0; max-width: 9rem; min-height: 38px; margin: 0;
  padding: .45rem .2rem; font-size: .8rem; font-weight: 600; line-height: 1.2;
  background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px;
  white-space: nowrap;
}
.wtabs button.on { background: #fff; color: #16202c; }  /* readable in light and dark */

/* an approved month reads as it was filed */
.pane.closed { opacity: .72; }
.pane.closed .card { background: color-mix(in srgb, var(--card) 85%, var(--paper)); }
