/* app shell */
body.app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--paper); }
.app-top { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.app-top .bar { max-width: 640px; margin: 0 auto; display: flex; align-items: center; height: 58px; padding: 0 16px; gap: 10px; }
.app-top .brand { font-size: 21px; }
.app-top .brand img { width: 32px; height: 32px; border-radius: 9px; }
.app-top .right { margin-left: auto; }
main#view { max-width: 640px; margin: 0 auto; padding: 18px 16px 28px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs .row { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 10px; text-decoration: none; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.tabs a .i { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--ink); }
.tabs a.on .i { filter: none; opacity: 1; }

.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.monthnav button { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 22px; cursor: pointer; color: var(--ink); }
.monthnav button[disabled] { opacity: .3; }
.monthnav h2 { font-size: 24px; margin: 0; }
.status { text-align: center; font-weight: 700; font-size: 19px; margin: 10px 0 4px; }
.status.done { color: var(--green-2); }
.sub { text-align: center; color: var(--ink-2); margin: 0 0 16px; font-size: 16px; }
.incomebar { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 16px; font-size: 15.5px; }
.incomebar .track { height: 10px; background: var(--sun-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.incomebar .fill { height: 100%; background: var(--green); border-radius: 99px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.clock { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 14px; }
.clock .t { font: 700 32px/1 var(--head); font-variant-numeric: tabular-nums; }
.clock .l { font-size: 14px; opacity: .8; }
.clock .btn { margin-left: auto; }

.list { list-style: none; margin: 0; padding: 0; }
.dayhead { font-weight: 700; color: var(--ink-3); font-size: 14px; text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; text-decoration: none; color: var(--ink); }
.item .em { font-size: 26px; width: 34px; text-align: center; }
.item .mid { flex: 1; min-width: 0; }
.item .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-size: 14px; color: var(--ink-2); }
.item .h { font: 700 22px var(--head); }
.item .h small { font: 700 13px var(--body); color: var(--ink-3); }
.empty { text-align: center; padding: 26px 10px; color: var(--ink-2); }
.empty .big { font-size: 46px; }

/* forms */
.form label.f { display: block; font-weight: 700; margin: 16px 0 6px; }
.form .hint { font-size: 14.5px; color: var(--ink-2); font-weight: 400; display: block; margin-top: 2px; }
.form input[type=text], .form input[type=tel], .form input[type=email], .form input[type=date], .form input[type=number], .form select, .form textarea {
  width: 100%; min-height: 52px; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; font: 18px var(--body); color: var(--ink); background: #fff; }
.form textarea { min-height: 84px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: 700 16px var(--body); color: var(--ink); cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--sun-3); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 52px; height: 52px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 26px; cursor: pointer; color: var(--ink); }
.stepper input { text-align: center; font: 700 26px var(--head) !important; max-width: 120px; }
.quick { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.quick button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: 700 15px var(--body); cursor: pointer; color: var(--ink); }
.formbar { display: flex; gap: 10px; margin-top: 26px; }
.formbar .btn { flex: 1; }
.danger { color: var(--red); background: none; border: 0; font: 700 16px var(--body); cursor: pointer; padding: 14px 0; text-decoration: underline; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 16px; }
.check input { width: 24px; height: 24px; margin-top: 2px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sun-3); border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center; text-align: center; font-size: 13px; font-weight: 700; padding: 0; color: var(--ink); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(31,26,77,.78); color: #fff; font-size: 11.5px; padding: 3px 6px; }
.addproof { display: flex; gap: 8px; flex-wrap: wrap; }

.sheet-bg { position: fixed; inset: 0; background: rgba(31,26,77,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet img.full { width: 100%; border-radius: 12px; }
canvas.sig { width: 100%; background: #fff; border: 2px dashed var(--ink-3); border-radius: 12px; display: block; }

.letter { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; font-size: 16.5px; }
.letter table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15.5px; }
.letter td, .letter th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill.draft { background: #EEE; color: #555; }
.pill.sent { background: var(--sun-3); color: #8A5A00; }
.pill.signed { background: var(--green-3); color: var(--green-2); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 80; box-shadow: var(--shadow); max-width: 92vw; text-align: center; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 44px; margin: 12px 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font: 700 17px var(--head); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.rowline { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.center { text-align: center; }
.mt { margin-top: 18px; }
