/* App-specific styles, layered on /style.css */
body.app { padding-bottom: 84px; }
header.site .badge { font-size: .8em; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; white-space: nowrap; }
header.site .badge.pending { background: #e9c46a; color: #3a2a00; }
header.site .badge.offline { background: #b8b2a4; color: #222; }
header.site .badge.error { background: #d9534f; color: #fff; }

.tabs { display: flex; gap: 6px; margin: 14px 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; min-height: 44px; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.chip { min-height: 48px; padding: 10px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.chip.small { min-height: 40px; padding: 6px 12px; font-weight: 500; }
.chip.add { border-style: dashed; color: var(--green); }

.unit-toggle { display: flex; gap: 6px; }
.unit-toggle .chip { flex: 1; text-align: center; }

.big-input { font-size: 1.6em; font-weight: 700; text-align: right; }

.row-list { list-style: none; padding: 0; margin: 0; }
.row-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.row-list .main { flex: 1; min-width: 0; }
.row-list .title { font-weight: 700; }
.row-list .sub { color: var(--muted); font-size: .92em; }
.row-list .val { font-family: Georgia, serif; font-size: 1.15em; font-weight: 700; white-space: nowrap; }
.row-list li.clickable { cursor: pointer; }
.row-list li.clickable:hover { background: #f3f1ea; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat .n { font-family: Georgia, serif; font-size: 1.5em; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85em; }

.pending-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e9c46a; margin-left: 6px; vertical-align: middle; }
.conflict { color: #9b2c2c; font-size: .85em; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.btn.danger, button.danger { background: #9b2c2c; }
.btn.ghost, button.ghost { background: transparent; color: var(--green); border: 2px solid var(--green); }
button.link { background: none; color: var(--green); padding: 4px 6px; min-height: 0; font-weight: 600; text-decoration: underline; }

.sticky-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; z-index: 5; }
.sticky-bar button { flex: 1; font-size: 1.1em; }

.flag { display: inline-block; font-size: .78em; padding: 2px 8px; border-radius: 999px; margin-right: 4px; background: #f6edd6; color: #7a5a12; white-space: nowrap; }
.flag.s2 { background: #fde2e1; color: #9b2c2c; }
.flag.s3 { background: #9b2c2c; color: #fff; }

table.herd { font-size: .92em; }
table.herd td, table.herd th { padding: 6px 6px; }
table.herd th.num, table.herd td.num { text-align: right; }
table.herd tr.clickable { cursor: pointer; }
table.herd tr.clickable:hover { background: #f3f1ea; }
.group-head { background: var(--green-soft); font-weight: 700; }
.group-sub { background: #f5f3ec; color: var(--muted); font-weight: 600; font-size: .9em; }

.code-box { font-family: "SFMono-Regular", Menlo, monospace; font-size: 1.6em; letter-spacing: .08em; background: var(--green-soft); border: 2px dashed var(--green); border-radius: 10px; padding: 14px; text-align: center; margin: 10px 0; user-select: all; }

#toast-host { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1b1b1b; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .25s; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.err { background: #9b2c2c; }

.chart { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.chart text { font-family: -apple-system, system-ui, sans-serif; font-size: 11px; fill: #555; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .9em; margin: 6px 0 12px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--c); }

.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; align-items: center; }
.mapping-grid .target { font-weight: 600; }
.mapping-grid .target .req { color: #9b2c2c; }
@media (max-width: 520px) { .mapping-grid { grid-template-columns: 1fr; } .mapping-grid .target { margin-top: 8px; } }
.preview { font-size: .85em; }
.issue { color: #9b2c2c; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 120px; }
.inline-form input { margin-top: 4px; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty-state .big { font-size: 1.2em; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
