/* Content pieces used inside the tabs. Tokens come from style.css. */

/* ---- Shared ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.note { margin-top: 14px; font-size: 13px; color: var(--muted); max-width: 72ch; }
.seal-note { color: var(--seal); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.r { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.req { color: var(--seal); font-weight: 600; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.button svg { width: 18px; height: 18px; }
.button.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.button.seal { border-color: var(--seal); color: var(--seal); }
.button.seal:hover { background: var(--seal-wash); }
.button.primary.danger-fill { background: var(--seal); border-color: var(--seal); color: #fff; }
a.button { text-decoration: none; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--pine-2); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link.danger { color: var(--seal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link:not(.danger) { color: var(--good); } }

.badge { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.5; padding: 2px 8px; border-radius: 999px; background: var(--rule-soft); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge.good { background: var(--good-wash); color: var(--good); }
.badge.seal { background: var(--seal-wash); color: var(--seal); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th { font-size: 12.5px; font-weight: 500; color: var(--muted); border-bottom-color: var(--rule); }
th.r, td.r { text-align: right; }
tbody tr:last-child > * { border-bottom: 0; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--seal); }

.won-read { display: block; min-height: 1.4em; font-size: 12.5px; color: var(--brass); font-weight: 500; }
.dialog-intro { color: var(--muted); font-size: 14px; }
.field small { font-weight: 400; font-size: 12px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 20px; margin: 0 0 18px; }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.facts.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 0; }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.sub-head h3 small { font-weight: 400; }

/* ---- Insurance ---- */
.totals th[scope="row"] { font-weight: 600; white-space: nowrap; }
.totals td.r .num { font-size: 16px; font-weight: 600; }
.totals tr.dup th[scope="row"] { color: var(--seal); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 13px; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); }
.chips li b { font-weight: 600; }
.chips li.unsure { border-style: dashed; }

.policy-list { display: grid; gap: 12px; margin-top: 18px; }
.policy-list .sheet + .sheet { margin-top: 0; }
details.policy { padding: 0; }
details.policy > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 16px 20px; border-radius: var(--radius-sheet);
}
details.policy > summary::-webkit-details-marker { display: none; }
details.policy > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
details.policy[open] > summary::after { transform: rotate(225deg) translateY(-1px); }
.policy-name { display: grid; min-width: 0; }
.policy-name strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.policy-name small, .policy-premium small { font-size: 12.5px; }
.policy-premium { display: grid; justify-items: end; }
.policy-premium b { font-size: 16px; font-weight: 600; }
.policy-body { padding: 4px 20px 20px; border-top: 1px solid var(--rule-soft); }
.policy-body > .facts { margin-top: 16px; }
.policy-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px 28px; }
.policy-grid h3 { margin: 18px 0 8px; }
.policy-grid .sub-head h3 { margin: 0; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule-soft); }

/* Premium history reads like passbook lines: date, amount, change. */
.premium-log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-soft); }
.premium-log li { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px auto; align-items: baseline; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--rule); font-size: 14px; }
.premium-log b { font-weight: 600; }
.premium-log small { text-align: right; font-weight: 600; }
.premium-log .up { color: var(--seal); }
.premium-log .down { color: var(--good); }
.premium-log .link { font-size: 12.5px; }

/* ---- Payments and claims ---- */
.alert-sheet { border-color: color-mix(in srgb, var(--seal) 35%, var(--rule)); }
.alert-sheet h2 .badge { margin-left: 6px; font-size: 13px; }
.claims { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.claim { border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; background: var(--paper); }
.claim .sub-head { margin: 0 0 10px; align-items: flex-start; }
.claim p { margin-top: 8px; font-size: 14px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin: 4px 0 0; padding: 0; }
.steps li { position: relative; padding-top: 16px; font-size: 12.5px; color: var(--muted); text-align: center; }
.steps li::before { content: ''; position: absolute; top: 4px; left: 0; right: 0; height: 3px; background: var(--rule); }
.steps li::after { content: ''; position: absolute; top: 0; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--rule); }
.steps li.done::before, .steps li.now::before { background: var(--pine-2); }
.steps li.done::after { background: var(--pine-2); border-color: var(--pine-2); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now::after { border-color: var(--pine-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine-2) 25%, transparent); }
details.history { margin-top: 12px; font-size: 13.5px; }
details.history summary { cursor: pointer; color: var(--muted); }
details.history .claims { margin-top: 10px; }

@media (max-width: 860px) {
  details.policy > summary { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; gap: 4px 12px; }
  details.policy > summary .badge { grid-column: 1 / -1; justify-self: start; }
  details.policy > summary::after { display: none; }
  .policy-body { padding: 4px 16px 16px; }
  .policy-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .claims { grid-template-columns: 1fr; }
  .card-actions .button { flex: 1; }
}

/* Phone: each table row becomes a small card. The .lead-cell names the row; other cells carry their column name. */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--rule-soft); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td, table.stack th { padding: 0; border: 0; text-align: left; }
  table.stack td:last-child:not(.lead-cell, .chips-cell) { text-align: right; align-self: end; }
  .totals.stack td.r { text-align: right; }
  table.stack .lead-cell { grid-column: 1 / -1; order: -1; font-weight: 600; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
  table.stack tr.overdue { box-shadow: inset 3px 0 0 var(--seal); padding-left: 12px; }
  table.stack tr.overdue td:first-child { box-shadow: none; }
  table.stack .chips-cell { grid-column: 1 / -1; padding-top: 4px; }
  .totals.stack th[scope="row"] { align-self: start; }
}
