/* communityaddons.app: the apps' own palette (Lucify/src/ui/theme.ts) and plain system type. */
:root {
  --bg: #0B0B0C; --surface: #161618; --raised: #202023; --border: #2A2A2E;
  --text: #F3F3F3; --muted: #A3A3A8; --faint: #6B6B70;
  --accent: #C9CDD3; --accent-fill: linear-gradient(180deg, #EEF0F3, #A7ADB6); --on-accent: #121212;
  --danger: #E5484D; --ok: #6FD3A8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
p { margin: 0 0 12px; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

.top { border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand .app { color: var(--muted); font-weight: 600; }
.top nav { margin-left: auto; display: flex; gap: 18px; font-size: 14px; font-weight: 600; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--text); }

main { padding: 32px 0 60px; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; margin: 0 0 8px; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 12px; }
.lead { color: var(--muted); margin-bottom: 20px; max-width: 640px; }
.group { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--faint); margin: 28px 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 20px; background: var(--raised); color: var(--text); font: 700 14px system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }

.repo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); }
.repo code { flex: 1 1 260px; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.repo + .note { color: var(--faint); font-size: 13px; margin-top: 8px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 14px; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--surface); color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 15px system-ui, sans-serif; }
.chip { height: 36px; padding: 0 14px; border: 0; border-radius: 18px; background: var(--raised); color: var(--text); font: 700 14px system-ui, sans-serif; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.count { color: var(--faint); font-size: 13px; margin: 0 0 10px; }
.sort { height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--raised); color: var(--text); font: 700 14px system-ui, sans-serif; cursor: pointer; }

.list { display: grid; gap: 10px; }
.addon { display: flex; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface); }
.tile { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; overflow: hidden; background: var(--raised); color: var(--muted); font-weight: 800; font-size: 20px; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.addon .body { flex: 1; min-width: 0; }
.addon h3 { margin: 0; font-size: 16px; font-weight: 700; }
.addon .meta { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.addon .meta a { color: var(--muted); }
.addon .desc { color: var(--text); margin: 0 0 6px; }
.addon .stats { color: var(--accent); font-size: 13px; margin: -4px 0 6px; }
.addon .perm { color: var(--faint); font-size: 13px; margin: 0 0 10px; }
.stars { display: inline-flex; margin-left: auto; }
.stars button { border: 0; background: none; padding: 0 2px; font-size: 18px; line-height: 1; color: var(--faint); cursor: pointer; }
.stars button.on, .stars:hover button { color: var(--accent); }
.stars button:hover ~ button { color: var(--faint); }
.addon .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.addon .actions .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.addon .report { border: 0; background: none; color: var(--faint); font: 13px system-ui, sans-serif; cursor: pointer; text-decoration: underline; }
.empty { color: var(--muted); padding: 28px; text-align: center; border-radius: 14px; background: var(--surface); margin: 0; }

.apps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.appcard { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; }
.appcard:hover { background: var(--raised); }
.appcard img { width: 56px; height: 56px; border-radius: 14px; }
.appcard b { display: block; font-size: 17px; }
.appcard span { color: var(--muted); font-size: 13px; }

form.panel { max-width: 560px; padding: 20px; border-radius: 14px; background: var(--surface); }
label.field { display: block; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
label.field small { display: block; color: var(--faint); font-weight: 400; font-size: 13px; }
.field input, .field select, .field textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: 15px system-ui, sans-serif; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--accent); }
.msg { margin: 12px 0 0; min-height: 1.5em; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }
.notes { max-width: 640px; color: var(--muted); margin-top: 28px; }
.notes li { margin-bottom: 6px; }

dialog { width: min(480px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 20px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog .target { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

.foot { border-top: 1px solid var(--border); padding: 20px 0 32px; color: var(--faint); font-size: 13px; }
.foot a { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--raised); color: var(--text); font-weight: 600; font-size: 14px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.on { opacity: 1; }

@media (max-width: 600px) {
  .apps { grid-template-columns: 1fr; }
  .top nav { gap: 14px; }
  .brand { white-space: nowrap; }
  .brand .app, .top nav .wide { display: none; }
}
