:root {
  color-scheme: light dark;
  --tabbar-h: 62px;
  --accent: #1a7f37;
  --line: #ddd;
  --muted: #888;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, system-ui, sans-serif;
  line-height: 1.4;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem .9rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: canvas; z-index: 10;
}
.brand { font-weight: 700; text-decoration: none; color: inherit; font-size: 1.1rem; }
.logout { font-size: .85rem; text-decoration: none; color: var(--muted); }
main { max-width: 640px; margin: 0 auto; padding: .9rem; }
.flash { background: #fff3cd; color: #664d03; padding: .5rem .8rem; border-radius: 6px; }
h2 { margin: .4rem 0 .8rem; font-size: 1.35rem; }
.count { font-size: .8em; color: var(--muted); }
.summary { color: var(--muted); }
.meta { display: block; font-size: .8rem; color: var(--muted); }
.score { font-size: .75rem; color: #2a7; font-weight: 600; }

/* timeline rows */
.exp { display: flex; gap: .7rem; align-items: center; padding: .65rem .2rem;
  border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
a.exp:active { background: #f4f4f4; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px;
  background: #eee; flex-shrink: 0; }
.thumb.placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #94a3b8;
  font-size: 10px; font-weight: 700; text-align: center; line-height: 1.2;
  padding: 4px;
}
.thumb.placeholder.recurring { background: #fef3c7; color: #b45309;
  flex-direction: column; gap: 2px; }
.ricon { font-size: 22px; line-height: 1; }
.rlabel { font-size: 9px; }
.exp > div { flex: 1; min-width: 0; }
.exp strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* bottom tab bar (SuperK-style) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(250,250,250,.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none;
  font-size: 10.5px; font-weight: 700;
}
.tab .ti { font-size: 21px; line-height: 1; }
.tab.active { color: var(--accent); }

/* inbox upload */
.upload { margin: .5rem 0 1rem; display: flex; gap: .6rem; }
.snap { flex: 1; display: block; text-align: center; padding: 1rem; font-size: 1.05rem;
  border: 2px dashed #888; border-radius: 10px; cursor: pointer; position: relative; }
.snap input {
  /* Visually hidden but still in the accessibility tree (NOT display:none),
     so assistive tech and automation can still open the file chooser. */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

img.full { width: 100%; border-radius: 8px; border: 1px solid #ccc; }
.card { border: 1px solid #ccc; border-radius: 10px; padding: .9rem; margin: .9rem 0; }
.card label { display: block; margin-bottom: .7rem; font-size: .85rem; color: var(--muted); }
.card input, .card select { width: 100%; padding: .55rem; font-size: 1rem;
  border: 1px solid #bbb; border-radius: 6px; margin-top: .2rem; background: canvas; color: canvastext; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.sugg { display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; }
.sugg > div { flex: 1; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
button, .btn { padding: .6rem 1rem; font-size: 1rem; border-radius: 8px;
  border: 1px solid #999; background: canvas; color: canvastext; cursor: pointer;
  text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { color: #c00; border-color: #c00; }
h3 { margin: 1rem 0 .5rem; font-size: 1rem; }
pre { white-space: pre-wrap; font-size: .75rem; max-height: 200px; overflow: auto; }
details.card summary { cursor: pointer; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.filters select, .filters input { padding: .5rem; font-size: .95rem; border-radius: 6px;
  border: 1px solid #bbb; background: canvas; color: canvastext; }

table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .8rem; }
td, th { text-align: left; padding: .35rem .3rem; border-bottom: 1px solid var(--line); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

main.login { max-width: 320px; margin-top: 15vh; text-align: center; }
main.login input { width: 100%; padding: .7rem; font-size: 1.1rem; margin-bottom: .7rem;
  border-radius: 8px; border: 1px solid #bbb; }
main.login button { width: 100%; }

.pagehead { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.pagehead h2 { margin: .4rem 0; }

/* vault gallery */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: .8rem; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #eee; }
.gallery figcaption { display: flex; justify-content: space-between; align-items: center;
  gap: .3rem; padding: .3rem .4rem; font-size: .72rem; }
.gallery .cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery .dl { font-size: 1.1rem; text-decoration: none; padding: .1rem .3rem; }
