/* App screens. Builds on site.css (tokens, type, buttons). */

.app-main { padding: 28px 0 80px; min-height: 70vh; }
.app-main .wrap { display: grid; gap: 28px; }

.btn-plain { background: none; color: var(--ink-soft); cursor: pointer; font: inherit; }
.wallet { display: inline-flex; align-items: center; gap: 8px; }
.wallet .addr-chip {
  font-family: var(--mono); font-size: .85rem; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
}
.wallet .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--paid); display: inline-block; margin-right: 6px; }
.wallet .dot.off { background: var(--late); }

.crumbs { font-size: .9rem; color: var(--pencil); }
.crumbs a { color: var(--ink-soft); }

.page-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.05; margin: 0; overflow-wrap: anywhere; }
.page-sub { color: var(--ink-soft); margin: 10px 0 0; font-size: 1.05rem; }

.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: clamp(18px, 3vw, 26px); }
.panel h2, .panel h3 { font-family: var(--serif); font-weight: 400; margin: 0 0 12px; line-height: 1.15; }
.panel h2 { font-size: 1.6rem; }
.panel h3 { font-size: 1.25rem; }
.panel p:last-child { margin-bottom: 0; }
.panel.quiet { background: transparent; border-style: dashed; }
.panel.warn { border-color: var(--late); }
.panel.bad { border-color: var(--owed); }

.muted { color: var(--pencil); }
.small { font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }
.addr { font-family: var(--mono); font-size: .88em; overflow-wrap: anywhere; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }

.facts-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 16px 0 0; padding: 0; list-style: none; }
.facts-row li { display: grid; gap: 2px; }
.facts-row b { font-weight: 400; font-family: var(--serif); font-size: 1.35rem; line-height: 1.1; }
.facts-row span { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--pencil); font-weight: 700; }

.pill { display: inline-flex; align-items: center; gap: 6px; font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; border: 1px solid currentColor; }
.pill.open { color: var(--rosa-text); }
.pill.running { color: var(--paid); }
.pill.finished { color: var(--ink-soft); }
.pill.cancelled { color: var(--pencil); }

/* Tanda screen */
.tanda-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: clamp(20px, 4vw, 48px); align-items: start; }
@media (max-width: 900px) { .tanda-top { grid-template-columns: minmax(0, 1fr); } }
.ring-box { max-width: 560px; }
.ring-box svg { width: 100%; height: auto; display: block; }
.seat.pick { cursor: pointer; }
.seat.pick:hover circle, .seat.pick:focus-visible circle { stroke: var(--rosa); stroke-width: 2.4; }
.seat.me circle { stroke: var(--rosa); stroke-width: 3; }
.seat.late circle { stroke: var(--late); stroke-width: 2.6; }
.seat-name.me { fill: var(--rosa-text); font-weight: 700; }

.big-number { font-family: var(--serif); font-size: 2.6rem; line-height: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--pencil); font-size: .9rem; }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.seat-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.seat-btn {
  display: grid; gap: 2px; text-align: left; padding: 10px 11px; border-radius: 6px;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; font: inherit;
}
.seat-btn b { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; line-height: 1; }
.seat-btn span { font-size: .8rem; color: var(--pencil); font-variant-numeric: tabular-nums; }
.seat-btn:hover:not([disabled]) { border-color: var(--rosa); }
.seat-btn[disabled] { opacity: .45; cursor: not-allowed; background: transparent; }
.seat-btn.taken b::after { content: " ·"; color: var(--pencil); }

/* The notebook (ledger) */
.libreta-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.libreta { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 640px; }
.libreta th { font: 700 .7rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--pencil); text-align: left; padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
.libreta td { padding: 10px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.libreta tr.me td { background: color-mix(in srgb, var(--rosa-soft) 55%, transparent); }
.libreta .n { font-family: var(--serif); font-size: 1.2rem; width: 2.2em; }
.libreta .who b { font-weight: 700; display: block; }
.libreta .who .addr { color: var(--pencil); font-size: .78rem; }
.libreta .tag { font: 700 .66rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--rosa-text); margin-left: 6px; }
.libreta .rec { font-size: .78rem; color: var(--pencil); }
.marks { display: flex; gap: 3px; flex-wrap: wrap; max-width: 280px; }
.mark { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--rule); display: inline-block; }
.mark.paid { background: var(--paid); border-color: var(--paid); }
.mark.ahead { background: color-mix(in srgb, var(--paid) 45%, transparent); border-color: var(--paid); }
.mark.late { background: var(--late); border-color: var(--late); }
.mark.collect { outline: 2px solid var(--rosa); outline-offset: 1px; }
.owes { color: var(--owed); font-weight: 700; }
.owed { color: var(--late); font-weight: 700; }
.ok { color: var(--paid); font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--pencil); margin-top: 12px; }
.legend .mark { vertical-align: -3px; margin-right: 5px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(20px, 4vw, 48px); align-items: start; }
@media (max-width: 900px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 700; font-size: .95rem; }
.field .help { font-size: .86rem; color: var(--pencil); margin: 0; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; border-radius: 6px; border: 1.5px solid var(--rule);
  background: var(--paper); color: var(--ink); font: 400 1rem/1.3 var(--sans);
}
.input:focus { outline: none; border-color: var(--ink); }
.input.money { font-variant-numeric: tabular-nums; }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--pencil); pointer-events: none; }
.input-affix .input { padding-left: 28px; }
.seg { display: inline-flex; border: 1.5px solid var(--rule); border-radius: 7px; padding: 3px; gap: 3px; flex-wrap: wrap; background: var(--paper); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 12px; border-radius: 5px; font-size: .95rem; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.inline-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 520px) { .inline-fields { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.err { color: var(--owed); font-size: .9rem; margin: 0; }

.summary .big { font-family: var(--serif); font-size: 2.2rem; line-height: 1; margin: 2px 0 6px; }
.summary .lines { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; font-size: .95rem; }
.deps { display: grid; gap: 5px; margin-top: 14px; font-size: .88rem; }
.deps .bar { grid-template-columns: 2.4em minmax(0, 1fr) 5.8em; }

/* Lists */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tcard { display: grid; gap: 8px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 18px; }
.tcard:hover { border-color: var(--ink); }
.tcard h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 0; }
.tcard .meta { font-size: .9rem; color: var(--ink-soft); }

/* Dialog */
dialog.sheet { border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.sheet::backdrop { background: rgba(20, 18, 14, .45); }
dialog.sheet .sheet-body { padding: 22px 22px 18px; display: grid; gap: 14px; }
dialog.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin: 0; }
dialog.sheet .steps-tx { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
dialog.sheet .steps-tx li { display: flex; gap: 10px; align-items: center; font-size: .95rem; }
dialog.sheet .steps-tx li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--pencil); flex: none; }
dialog.sheet .steps-tx li.doing::before { border-color: var(--rosa); background: var(--rosa-soft); }
dialog.sheet .steps-tx li.done::before { border-color: var(--paid); background: var(--paid); }
.wallet-list { display: grid; gap: 8px; }
.wallet-list button { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: 700 1rem/1 var(--sans); cursor: pointer; }
.wallet-list button:hover { border-color: var(--ink); }
.wallet-list img { width: 28px; height: 28px; border-radius: 6px; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(520px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 12px 14px; font-size: .95rem; box-shadow: 0 10px 30px -12px rgba(0,0,0,.45); display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.toast a { color: inherit; }
.toast.bad { background: var(--owed); color: #fff; }
.toast button { background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; opacity: .7; }

.notice { border-left: 3px solid var(--rosa); padding: 10px 14px; background: var(--card); border-radius: 0 6px 6px 0; }
.notice.warn { border-left-color: var(--late); }
.notice.bad { border-left-color: var(--owed); }

.skeleton { color: transparent; background: linear-gradient(90deg, var(--rule-soft), var(--paper-deep), var(--rule-soft)); background-size: 200% 100%; border-radius: 4px; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.dev-bar { position: fixed; left: 12px; bottom: 12px; z-index: 60; background: #111; color: #eee; border-radius: 6px; padding: 8px 10px; font: 12px/1.3 var(--mono); display: grid; gap: 6px; opacity: .92; }
.dev-bar select, .dev-bar button { font: inherit; }
