/* 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; font-weight: 700; font-size: 15px; white-space: nowrap; }
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(4, 1fr); }
body.setup .tabs { display: none; }
body.setup.app { padding-bottom: 24px; }
.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; }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.weeknav button { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 22px; cursor: pointer; color: var(--ink); }
.weeknav button[disabled] { opacity: .3; }
.weeknav h2 { font-size: 21px; margin: 0; text-align: center; }
.weeknav h2 small { display: block; font: 700 13px var(--body); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.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; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.actions.one { grid-template-columns: 1fr; }

.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); width: 100%; text-align: left; font: inherit; }
.item .em { font-size: 26px; width: 34px; text-align: center; flex: none; }
.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); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 22px 10px; color: var(--ink-2); }
.empty .big { font-size: 46px; }

/* forms */
.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 input[type=url], .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); }
.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: 110px; }
.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; }
details.more { border: 2px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; margin-top: 18px; }
details.more summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
details.more[open] { padding-bottom: 14px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--blue-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; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 16px; font-weight: 700; font-size: 15px; width: max-content; z-index: 80; box-shadow: var(--shadow); max-width: 92vw; text-align: center; }
.rowline { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.center { text-align: center; }

/* copy view: one card per contact, a copy button per field */
.copycard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; }
.copycard h3 { font-size: 17px; font-family: var(--body); font-weight: 700; margin: 10px 0 4px; }
.cf { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.cf:first-of-type { border-top: 0; }
.cf .k { font-size: 12.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.cf .v { font-size: 16px; overflow-wrap: anywhere; }
.cf > div { flex: 1; min-width: 0; }
.cf button { flex: none; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font: 700 14px var(--body); color: var(--ink); cursor: pointer; }
.cf button.ok { border-color: var(--green); color: var(--green-2); }

.range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 16px; }
.check input { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--green-2); }
.mini { font-size: 14px; color: var(--ink-2); }
