:root {
  --bg: #f4f2ee; --panel: #ffffff; --text: #1d1c1a; --muted: #6f6b64; --line: #e3dfd8;
  --accent: #2f6f5e; --accent-text: #fff; --danger: #b3412f; --star: #e0a526;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --panel: #201f1d; --text: #ecebe8; --muted: #a29e96; --line: #33312d;
          --accent: #5fb39a; --accent-text: #0f1a16; --danger: #e0715f; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
code { font-size: .9em; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
       padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.top nav { display: flex; align-items: center; gap: 16px; }
.top nav form { margin: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
main.center { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; overflow-x: auto; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
input:not([type=checkbox]) { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); min-width: 0; }
button, .btn { font: inherit; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); cursor: pointer; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; text-align: center; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--panel); width: 100%; max-width: 1200px; }
.flash.err { border-color: var(--danger); color: var(--danger); }
.flash.ok { border-color: var(--accent); }
.toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input { flex: 1; max-width: 420px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.app { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
       border-radius: 12px; overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.app:hover { transform: translateY(-2px); border-color: var(--accent); }
.app.archived { opacity: .6; }
.thumb { aspect-ratio: 16/9; background: var(--bg); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .icon { font-size: 44px; }
.meta { padding: 12px 14px 14px; }
.title { font-weight: 600; }
.desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.star { position: absolute; top: 8px; right: 8px; border: 0; background: var(--panel); border-radius: 50%; width: 30px; height: 30px; padding: 0;
        color: var(--line); font-size: 17px; line-height: 30px; opacity: .9; }
.star.on { color: var(--star); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-weight: 400; }
table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr.inactive td { opacity: .55; }
form.inline, td.actions form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
form.perms { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0; }
input.copy { width: 100%; min-width: 260px; font-size: 13px; }
@media (max-width: 640px) { .top { padding: 10px 16px; } .top nav { gap: 10px; font-size: 14px; } }
