/* app shell: bottom tabs on phones, header tabs and two columns on computers */
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: 1120px; margin: 0 auto; display: flex; align-items: center; height: 62px; padding: 0 20px; gap: 10px; }
.app-top .brand { font-size: 22px; }
.app-top .brand img { width: 34px; height: 34px; border-radius: 9px; }
.app-top .right { margin-left: auto; font-weight: 700; font-size: 15px; }
.dtabs { display: none; margin-left: auto; gap: 4px; }
.dtabs a { text-decoration: none; font-weight: 700; font-size: 16px; padding: 9px 14px; border-radius: 999px; color: var(--ink-2); }
.dtabs a:hover { background: var(--acc-3); color: var(--ink); }
.dtabs a.on { background: var(--ink); color: #fff; }
main#view { max-width: 1120px; margin: 0 auto; padding: 18px 20px 36px; }
.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); }
.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; }
@media (min-width: 900px) {
  body.app { padding-bottom: 0; }
  .tabs { display: none; }
  .dtabs { display: flex; }
  .app-top .right { margin-left: 8px; }
  main#view { padding: 28px 24px 56px; }
}

main#view h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: .3em; }
.h2s { font-size: 24px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead > div:first-child { min-width: 0; }
.pagehead h1 { overflow-wrap: anywhere; }
.headbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--ink-2); margin: 0 0 16px; font-size: 16px; }
.hint { font-size: 14.5px; color: var(--ink-2); font-weight: 400; }
.dash { display: grid; gap: 22px; }
@media (min-width: 900px) { .dash { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 32px; align-items: start; } }
.dash aside h3:first-child { margin-top: 0; }
.welcome { max-width: 680px; padding: 18px 0; }
.welcome .lede { font-size: 19px; }
.narrowform { max-width: 680px; }
.two { display: grid; gap: 0 16px; }
@media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
ul.tight { margin: 6px 0 0; padding-left: 1.2em; }
ul.tight li { margin: 3px 0; }

/* summary */
.sumrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 20px; }
.sum { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; border-top: 5px solid var(--line); }
.sum b { display: block; font: 700 30px/1.1 var(--head); }
.sum span { font-size: 14px; color: var(--ink-2); font-weight: 700; line-height: 1.3; display: block; }
.sum.red { border-top-color: var(--red); }
.sum.amber { border-top-color: var(--amber); }
.sum.ok { border-top-color: var(--acc); }

/* due list */
.duelist { list-style: none; margin: 0; padding: 0; }
.due { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 14px; margin-bottom: 8px; overflow: hidden; }
.due.red { border-left-color: var(--red); }
.due.amber { border-left-color: var(--amber); }
.due.ok { border-left-color: var(--acc); }
.due-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.due-main:hover { background: var(--acc-3); }
.due .mid { flex: 1; min-width: 0; }
.due .t1 { display: block; font-weight: 700; line-height: 1.3; }
.due .t2 { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
.due .when { text-align: right; font-size: 14px; line-height: 1.3; flex: none; max-width: 42%; }
.due .when b { display: block; font-size: 15px; white-space: nowrap; }
.due .when span { color: var(--ink-2); }
.due.red .when span { color: var(--red-2); font-weight: 700; }
.due.amber .when span { color: var(--amber-2); font-weight: 700; }
.cal { flex: none; width: 52px; border: 0; border-left: 1px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.cal:hover { background: var(--acc-3); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; text-decoration: none; color: var(--ink); text-align: left; font: inherit; }
.item:hover { border-color: var(--ink); }
.item .em { font-size: 24px; width: 32px; text-align: center; flex: none; }
.item .mid { flex: 1; min-width: 0; }
.item .t1 { display: block; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.item .t2 { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.empty { text-align: center; padding: 26px 10px; color: var(--ink-2); background: #fff; border: 1px dashed var(--line); border-radius: 14px; }
.empty .big { font-size: 42px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; flex: none; }
.pill.red { background: var(--red-3); color: var(--red-2); }
.pill.amber { background: var(--amber-3); color: var(--amber-2); }
.pill.ok { background: var(--acc-3); color: var(--acc-dd); }
.pill.grey { background: #EFEDE7; color: #5B5870; }

/* requirement cards on a unit */
.reqs { list-style: none; margin: 0; padding: 0; }
.req { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.req.red { border-left-color: var(--red); }
.req.amber { border-left-color: var(--amber); }
.req.ok { border-left-color: var(--acc); }
.req-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.req .prog { font-size: 13.5px; color: var(--ink-3); font-weight: 700; }
.req h3 { font-size: 20px; margin: 0 0 4px; }
.req p { margin: 0 0 6px; }
.req .duetxt { font-size: 16px; }
.req .recline { font-size: 14.5px; color: var(--ink-2); overflow-wrap: anywhere; }
details.fee { margin: 4px 0 0; }
details.fee summary { cursor: pointer; font-size: 14.5px; font-weight: 700; color: var(--ink-2); }
details.fee p { margin: 6px 0 0; }
.req-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* forms */
.form label.f { display: block; font-weight: 700; margin: 16px 0 6px; }
.form .hint { display: block; margin-top: 2px; }
.form input[type=text], .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: 17px 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); }
.formbar { display: flex; gap: 10px; margin-top: 24px; align-items: center; flex-wrap: wrap; }
.formbar .btn { flex: 0 1 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 16px; 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(--acc-3); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 15.5px; line-height: 1.4; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--acc-d); }
.danger { color: var(--red); background: none; border: 0; font: 700 16px var(--body); cursor: pointer; padding: 14px 0; text-decoration: underline; }
.filebtn { cursor: pointer; }
.mt { margin-top: 18px; }
.center { text-align: center; }
.rowline { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
details.more { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; }
details.more summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
details.more[open] { padding-bottom: 12px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--acc-3); border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center; text-align: center; font-size: 13px; font-weight: 700; padding: 4px; color: var(--ink); }
.thumb img { position: absolute; inset: 0; 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; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.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: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; padding: 24px; } }
.sheet img.full { width: 100%; border-radius: 12px; }
.sheet .formbar .btn { flex: 1 1 140px; }
.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; }
@media (min-width: 900px) { .toast { bottom: 32px; } }

@media (max-width: 600px) {
  main#view { padding: 14px 16px 28px; }
  .app-top .bar { padding: 0 16px; height: 58px; }
  .app-top .brand { font-size: 20px; }
  .sumrow { gap: 8px; }
  .sum { padding: 10px; }
  .sum b { font-size: 26px; }
  .sum span { font-size: 12.5px; }
  .due-main { padding: 11px 12px; gap: 10px; }
  .due .when { max-width: 46%; font-size: 13px; }
  .cal { width: 46px; }
  .formbar .btn { flex: 1 1 100%; }
  .headbtns .btn { min-height: 40px; padding: 0 14px; font-size: 15px; }
}
