/* The AI → Approvals (public/lan-approvals.js) — theme tokens only, so every theme works */
.ap { --ap-r: 16px; }
.ap .grow { flex: 1; }
.ap-lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* Pulse */
.ap-pulse { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ap-k { position: relative; padding: 14px 16px; border-radius: var(--ap-r); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.ap-k b { display: block; font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; animation: ap-up .5s both cubic-bezier(.2,.8,.2,1); }
.ap-k span { font-size: 12.5px; color: var(--muted); }
.ap-k.hot b { color: var(--accent-text); } .ap-k.warn b { color: var(--warn); } .ap-k.ok b { color: var(--ok); }
.ap-k.hot::after { content: ''; position: absolute; inset: auto 0 0 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.ap-beat { position: absolute; top: 16px; right: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: ap-beat 1.8s infinite; }
@keyframes ap-beat { 70% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes ap-up { from { opacity: 0; transform: translateY(6px); } }

/* Bar */
.ap-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ap-bar .seg { margin: 0; }
.ap-n { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 18px; text-align: center; }
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.ap-chip span { color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }
.ap-chip.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.ap-rule { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ap-rule .i { width: 14px; height: 14px; }
.ap-rule b { color: var(--warn); font-weight: 600; }

/* Person card */
.ap-list { display: grid; gap: 14px; }
.ap-card { position: relative; border-radius: var(--ap-r); background: var(--surface); border: 1px solid var(--line); overflow: hidden; animation: ap-up .4s calc(var(--i) * 50ms) both cubic-bezier(.2,.8,.2,1); }
.ap-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: hsl(var(--h) 75% 60%); opacity: .85; }
.ap-who { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px 20px; flex-wrap: wrap; }
.ap-ava { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: hsl(var(--h) 80% 82%);
  background: linear-gradient(135deg, hsl(var(--h) 55% 30%), hsl(calc(var(--h) + 40) 55% 22%)); }
.ap-whot { display: grid; min-width: 0; }
.ap-whot b { font-size: 15.5px; }
.ap-whot span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-tag { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.ap-tag.link { cursor: pointer; color: var(--accent-text); background: var(--accent-soft); border-color: transparent; font-weight: 600; }
.ap-who .btn .i, .ap-act .btn .i { width: 15px; height: 15px; }

.ap-said { padding: 0 18px 12px 20px; display: grid; gap: 6px; justify-items: start; }
.ap-bub { position: relative; max-width: min(720px, 100%); padding: 8px 12px 8px; border-radius: 4px 14px 14px 14px; background: var(--soft); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ap-bub time { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.ap-file { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; padding: 1px 8px; border-radius: 6px; background: var(--hover); font-size: 12px; color: var(--ink); }
.ap-file .i { width: 13px; height: 13px; }
.ap-hint { display: flex; align-items: center; gap: 8px; margin: 0 18px 12px 20px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink-2); font-size: 13px; }
.ap-hint > .i { width: 16px; height: 16px; color: var(--warn); flex: none; }
.ap-hint span { flex: 1; }

/* One proposal */
.ap-items { border-top: 1px solid var(--line); }
.ap-it { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: start; padding: 14px 18px 14px 20px; transition: background .2s, opacity .3s; }
.ap-it + .ap-it { border-top: 1px dashed var(--line); }
.ap-it:hover { background: color-mix(in srgb, var(--hover) 45%, transparent); }
.ap-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.ap-ico .i { width: 18px; height: 18px; }
.ap-it.sends .ap-ico { background: var(--warn-soft); color: var(--warn); }
.ap-body { min-width: 0; }
.ap-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-head b { font-size: 14.5px; }
.ap-sure { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 99px; background: var(--soft); }
.ap-sure i { position: relative; width: 26px; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.ap-sure i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: currentColor; border-radius: 4px; animation: ap-w .8s both cubic-bezier(.2,.8,.2,1); }
@keyframes ap-w { from { width: 0; } }
.ap-sure.ok { color: var(--ok); } .ap-sure.warn { color: var(--warn); } .ap-sure.bad { color: var(--bad); }
.ap-does { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ap-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ap-facts span { font-size: 12px; padding: 3px 9px; border-radius: 8px; background: var(--soft); color: var(--ink-2); max-width: 100%; }
.ap-facts em { font-style: normal; color: var(--muted); margin-right: 6px; }
.ap-why { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.ap-why summary { cursor: pointer; width: max-content; list-style: none; }
.ap-why summary::-webkit-details-marker { display: none; }
.ap-why summary::before { content: '▸ '; } .ap-why[open] summary::before { content: '▾ '; }
.ap-why p { margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--line-2); }
.ap-act { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 150px; }
.ap-act .btn { justify-content: center; }
.ap-act .btn.warn { background: var(--warn); border-color: var(--warn); color: #1a1100; font-weight: 600; }
.ap-a { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; padding: 4px 0; white-space: nowrap; }
.ap-a .i { width: 13px; height: 13px; transform: rotate(-90deg); }

.ap-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); }
.ap-form label { display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); }
.ap-form label.wide { grid-column: 1 / -1; }
.ap-form input, .ap-form select, .ap-form textarea { width: 100%; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; }
.ap-form textarea { resize: vertical; line-height: 1.45; }

.ap-it.working { opacity: .55; pointer-events: none; }
.ap-it.is-done, .ap-it.is-gone { grid-template-columns: 36px 1fr auto; align-items: center; animation: ap-in .35s both; }
.ap-it.is-done .ap-ico { background: var(--ok-soft); color: var(--ok); }
.ap-it.is-done .ap-body b { color: var(--ok); }
.ap-it.is-gone { opacity: .6; } .ap-it.is-gone .ap-ico { background: var(--soft); color: var(--muted); }
.ap-it.is-done .ap-act, .ap-it.is-gone .ap-act { min-width: 0; }
@keyframes ap-in { from { background: var(--ok-soft); } }

/* Empty, history */
.ap-empty { display: grid; justify-items: center; gap: 6px; padding: 56px 20px; border-radius: var(--ap-r); border: 1px dashed var(--line-2); text-align: center; color: var(--muted); }
.ap-empty b { color: var(--ink); font-size: 16px; }
.ap-empty-i { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); margin-bottom: 4px; }
.ap-empty-i .i { width: 24px; height: 24px; }
.ap-hist { overflow-x: auto; padding: 0; }
.ap-hist table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ap-hist th { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
.ap-hist td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ap-hist tr:last-child td { border-bottom: 0; }
.ap-hist tr.rejected td:not(:last-child) { color: var(--muted); }
.ap-hist .sm { font-size: 11.5px; } .ap-hist .nowrap { white-space: nowrap; }
.ap-res { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.ap-res.ok { color: var(--ok); background: var(--ok-soft); } .ap-res.bad { color: var(--bad); background: var(--bad-soft); white-space: normal; } .ap-res.muted { color: var(--muted); background: var(--soft); }
.ap-loading { height: 240px; border-radius: var(--ap-r); }

@media (max-width: 760px) {
  .ap-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-rule { display: none; }
  .ap-it { grid-template-columns: 32px 1fr; }
  .ap-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .ap-act .btn.primary, .ap-act .btn.warn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .ap *, .ap { animation: none !important; transition: none !important; } }
