:root {
  --bg: #140c1a;
  --bg-2: #1d1326;
  --card: #241830;
  --card-2: #2e2139;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6eefc;
  --muted: #a898b5;
  --mango: #ff9f1c;
  --mango-2: #ffcf4a;
  --leaf: #5cc45c;
  --red: #ff5c6c;
  --blue: #6aa8ff;
  --accent-2: #ff7a1a;
  --on-accent: #1a0d05;
  --bg-fade: rgba(20, 12, 26, 0);
  --card-fade: rgba(36, 24, 48, 0);
  --tabbar: rgba(24, 15, 31, 0.88);
  --floating: rgba(46, 33, 57, .96);
  --icon-bg: #3a2a48;
  --switch-off: #3b2e47;
  --soft-text: #d9cde3;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--mango); }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.login-icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 40px rgba(255, 159, 28, .25); }
.login h1 { margin: 18px 0 4px; font-size: 28px; }
.login form { width: 100%; max-width: 340px; margin-top: 18px; display: grid; gap: 12px; }
.error-text { color: var(--red); min-height: 20px; margin: 0; font-size: 14px; }

/* ---------- layout ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: calc(var(--safe-t) + 14px) 18px 10px;
  background: linear-gradient(var(--bg) 70%, var(--bg-fade));
}
.top h1 { margin: 0; font-size: 32px; letter-spacing: -0.5px; }
main { padding: 4px 16px calc(96px + var(--safe-b)); max-width: 680px; margin: 0 auto; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--mango); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
.icon-btn:empty { visibility: hidden; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px calc(8px + var(--safe-b));
  background: var(--tabbar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tabs button {
  border: 0; background: none; display: grid; justify-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 500; padding: 2px 0; cursor: pointer;
}
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--mango); }

/* ---------- lists & cards ---------- */
.section-title { margin: 22px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
}
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--card-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app-icon {
  width: 54px; height: 54px; border-radius: 13px; flex: none; object-fit: cover;
  background: linear-gradient(135deg, var(--card-2), var(--icon-bg));
  display: grid; place-items: center; font-weight: 700; font-size: 22px; color: var(--mango);
  border: 1px solid var(--line);
}
.app-icon.big { width: 76px; height: 76px; border-radius: 18px; font-size: 30px; }

.pill {
  flex: none; border: 0; border-radius: 999px; padding: 6px 15px; font-weight: 700; font-size: 14px;
  background: rgba(255, 159, 28, .16); color: var(--mango); cursor: pointer; text-decoration: none;
}
.pill:active { opacity: .7; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; stroke: var(--mango); fill: none; stroke-width: 1.5; opacity: .9; }
.empty h3 { color: var(--text); margin: 12px 0 6px; }
.empty p { margin: 0 0 18px; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head h3 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.badge.good { background: rgba(92, 196, 92, .16); color: var(--leaf); }
.badge.bad { background: rgba(255, 92, 108, .16); color: var(--red); }
.badge.warn { background: rgba(255, 207, 74, .14); color: var(--mango-2); }
.badge.mango { background: rgba(255, 159, 28, .16); color: var(--mango); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 8px 0 4px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.card-actions .btn { flex: 1; }
.warning {
  background: rgba(255, 207, 74, .1); color: var(--mango-2); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; margin: 10px 0 0;
}
.warning.bad { background: rgba(255, 92, 108, .12); color: #ff9aa4; }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 0; border-radius: 13px; padding: 12px 16px; font-weight: 600; cursor: pointer;
  background: var(--card-2); color: var(--text); text-align: center; text-decoration: none; display: inline-block;
}
.btn:active { opacity: .75; }
.btn:disabled { opacity: .45; }
.btn.primary { background: linear-gradient(135deg, var(--mango), var(--accent-2)); color: var(--on-accent); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; display: block; }
.btn.big { padding: 16px; font-size: 17px; border-radius: 15px; }

input[type=text], input[type=password], input[type=url], input[type=tel], input[type=number], select {
  width: 100%; border: 1px solid var(--line); background: var(--bg-2); border-radius: 12px;
  padding: 12px 14px; outline: none; font-size: 16px;
}
input:focus, select:focus { border-color: var(--mango); }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); padding-left: 2px; }
.hint { font-size: 12px; color: var(--muted); padding-left: 2px; }

.group { background: var(--bg-2); border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row .row-main { font-size: 15px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--switch-off); border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--leaf); }
.switch input:checked + span::after { transform: translateX(20px); }

.file-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px dashed rgba(255, 159, 28, .45); background: rgba(255, 159, 28, .05); text-align: left; cursor: pointer;
}
.file-btn.chosen { border-style: solid; border-color: rgba(92, 196, 92, .5); background: rgba(92, 196, 92, .07); }
.file-btn .row-sub { white-space: normal; }
.file-btn svg { width: 22px; height: 22px; stroke: var(--mango); fill: none; stroke-width: 2; flex: none; }
.file-btn.chosen svg { stroke: var(--leaf); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border-radius: 999px; padding: 5px 6px 5px 11px; font-size: 13px; }
.chip button { border: 0; background: rgba(255,255,255,.1); border-radius: 50%; width: 20px; height: 20px; line-height: 18px; padding: 0; cursor: pointer; }

/* ---------- sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 0 18px calc(22px + var(--safe-b));
  animation: up .28s cubic-bezier(.2, .9, .3, 1);
  max-width: 680px; margin: 0 auto;
  will-change: transform;
}
.sheet.no-anim { animation: none; }
.grabber-zone {
  position: sticky; top: 0; z-index: 2; margin: 0 -18px 4px; padding: 8px 18px 10px;
  background: linear-gradient(var(--card) 75%, var(--card-fade));
  touch-action: none; cursor: grab;
}
.grabber { width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 0 auto; }
.sheet-x {
  position: absolute; right: 12px; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--card-2); color: var(--muted); font-size: 14px; cursor: pointer; display: grid; place-items: center;
}
.sheet.locked .sheet-x { display: none; }
.sheet.locked .grabber { opacity: .3; }
.sheet h2 { margin: 4px 0 14px; font-size: 22px; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; }
.actions { display: grid; gap: 8px; margin-top: 8px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- progress ---------- */
.progress-wrap { text-align: center; padding: 10px 0 4px; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%; margin: 10px auto 14px;
  border: 4px solid rgba(255, 159, 28, .2); border-top-color: var(--mango); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin: 12px 0 4px; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--mango), var(--mango-2)); width: 0; transition: width .2s; }
.log {
  text-align: left; background: #0e0812; border-radius: 12px; padding: 10px 12px; margin-top: 14px;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: #c9b8d6; max-height: 180px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.success-mark {
  width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 10px; display: grid; place-items: center;
  background: rgba(92, 196, 92, .15);
}
.success-mark svg { width: 34px; height: 34px; stroke: var(--leaf); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); z-index: 40;
  background: #fff; color: #1a0d05; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100% - 40px); text-align: center; animation: fade .2s;
}
.toast.error { background: var(--red); color: #fff; }

/* ---------- settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting .value { color: var(--muted); text-align: right; overflow-wrap: anywhere; font-size: 15px; }
.setting select { width: auto; padding: 6px 30px 6px 10px; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 26px; }

/* ---------- v1.1 additions ---------- */
.auth-pane { width: 100%; max-width: 340px; display: grid; gap: 12px; margin-top: 6px; }
.auth-pane form { margin-top: 4px; }
.auth-pane .warning { margin: 0; text-align: left; }
.link-btn { border: 0; background: none; color: var(--mango); font-weight: 600; padding: 8px; cursor: pointer; }
.center { text-align: center; }
.tabs { grid-template-columns: repeat(var(--tab-count, 4), 1fr); }
.row-title .badge { vertical-align: 2px; margin-left: 6px; }
.desc { color: var(--text); opacity: .85; font-size: 15px; margin: 0 0 14px; white-space: pre-wrap; }
.editor-row { background: var(--bg-2); border-radius: 12px; padding: 10px; display: grid; gap: 8px; margin-bottom: 8px; }
.editor-row .split { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.editor-row input, .editor-row select { padding: 9px 11px; font-size: 15px; background: var(--card); }
.editor-row .x { border: 0; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 92, 108, .15); color: var(--red); font-size: 18px; cursor: pointer; }
.add-key { width: 100%; margin-bottom: 14px; }
.ent-warn { color: #ff9aa4; font-size: 12px; margin-top: 3px; white-space: normal; }
.code-box {
  font: 600 26px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 2px; text-align: center;
  background: var(--bg-2); border-radius: 14px; padding: 16px; margin: 6px 0 14px; color: var(--mango);
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg-2); border-radius: 12px; padding: 12px 14px;
  outline: none; font: inherit; font-size: 16px; color: inherit; min-height: 86px; resize: vertical;
}
textarea:focus { border-color: var(--mango); }
.setting .switch { margin-left: auto; }
.setting + .row, .row + .setting { border-top: 1px solid var(--line); }

/* ---------- v1.2 library organization ---------- */
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 0 12px; margin-bottom: 10px; }
.searchbar svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2.2; flex: none; }
.searchbar input { border: 0; background: none; padding: 11px 0; font-size: 16px; width: 100%; outline: none; color: var(--text); }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.fchip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fchip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.fchip.on { background: var(--mango); color: #1a0d05; border-color: var(--mango); }
.fchip.on span { color: rgba(26, 13, 5, .65); }
.fchip.ghost { background: none; color: var(--mango); }
.lib-tools { display: flex; gap: 8px; align-items: center; margin: 2px 0 4px; }
.lib-tools select { width: auto; padding: 7px 34px 7px 12px; font-size: 14px; background-color: var(--card); }
.lib-tools .small-btn { margin-left: auto; padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.section-title .count { background: var(--card-2); color: var(--muted); border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; letter-spacing: 0; }
.shelf { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-card { flex: none; width: 112px; border: 0; background: var(--card); border-radius: 16px; padding: 14px 10px 12px; display: grid; justify-items: center; gap: 6px; cursor: pointer; text-align: center; }
.shelf-card .app-icon.big { width: 64px; height: 64px; border-radius: 15px; }
.shelf-name { font-weight: 600; font-size: 14px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-sub { color: var(--muted); font-size: 11px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { color: var(--mango-2); margin-left: 5px; font-size: 13px; }
.mango-text { color: var(--mango); }
.row.selected { background: rgba(255, 159, 28, .08); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; }
.check.on { background: var(--mango); border-color: var(--mango); }
.check svg { width: 14px; height: 14px; stroke: #1a0d05; fill: none; stroke-width: 3.5; }
.bulk-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(80px + var(--safe-b)); z-index: 12; max-width: 656px; margin: 0 auto;
  display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 16px;
  background: var(--floating); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.bulk-bar span { font-size: 13px; color: var(--muted); margin-right: auto; padding-left: 4px; }
.bulk-bar button { border: 0; background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
.bulk-bar button.danger { color: var(--red); }
.bulk-bar button:disabled { opacity: .4; }
.cat-row { gap: 8px; }
.cat-emoji { font-size: 24px; width: 34px; text-align: center; }
.mini { border: 0; background: var(--card-2); color: var(--text); border-radius: 9px; width: 34px; height: 34px; font-size: 15px; cursor: pointer; flex: none; }
.mini.danger { color: var(--red); }
.mini:disabled { opacity: .3; }
.setup-note { background: rgba(255, 159, 28, .1); color: var(--mango-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.link-btn.block { display: block; width: 100%; margin-top: 4px; }
.pill.dim { background: var(--card-2); color: var(--muted); }
.tabs button { position: relative; }
.tabs .dot { position: absolute; top: 2px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.stack-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg-2); gap: 2px; }
.s-lib { background: var(--mango); }
.s-signed { background: var(--blue); }
.s-certs { background: var(--leaf); }
.s-temp { background: #8a7a99; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.row .value { color: var(--muted); }

/* ---------- v1.2.1 update bar & what's new ---------- */
.update-bar {
  position: sticky; top: 0; z-index: 30; width: 100%; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: linear-gradient(135deg, var(--mango), var(--accent-2)); color: var(--on-accent); font-size: 15px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35); animation: drop .3s ease-out;
}
.update-bar b { font-weight: 800; }
.update-bar span { font-size: 12px; font-weight: 600; opacity: .75; }
body.has-update .top { padding-top: 14px; }
@keyframes drop { from { transform: translateY(-100%); } to { transform: none; } }
.wn { background: var(--bg-2); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.wn summary { list-style: none; cursor: pointer; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; }
.wn summary::-webkit-details-marker { display: none; }
.wn-ver { grid-row: span 2; background: rgba(255, 159, 28, .16); color: var(--mango); font-weight: 800; border-radius: 10px; padding: 6px 9px; font-size: 14px; }
.wn-title { font-weight: 700; }
.wn-date { color: var(--muted); font-size: 12px; }
.wn[open] summary { border-bottom: 1px solid var(--line); }
.wn-summary { margin: 12px 14px 4px; color: var(--text); opacity: .9; font-size: 15px; }
.wn-sec { padding: 4px 14px 6px; }
.wn-sec h4 { margin: 12px 0 6px; font-size: 15px; }
.wn-sec ul { margin: 0; padding-left: 18px; color: var(--soft-text); font-size: 14px; line-height: 1.5; }
.wn-sec li + li { margin-top: 5px; }

/* ---------- v1.2.4 motion & polish ---------- */
:root {
  --spring: cubic-bezier(.2, .9, .25, 1.15);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}
html { scroll-behavior: auto; }
body { text-rendering: optimizeLegibility; }

/* Press feedback everywhere: things shrink a touch and light up while your finger is on them */
.btn, .pill, .icon-btn, .fchip, .shelf-card, .mini, .file-btn, .link-btn, .bulk-bar button, .sheet-x, .update-bar, .chip button, .editor-row .x {
  transition: transform .18s var(--spring), filter .18s ease, background-color .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease, box-shadow .2s ease;
  will-change: transform;
}
.btn:active, .pill:active, .icon-btn:active, .fchip:active, .mini:active, .file-btn:active, .bulk-bar button:active, .sheet-x:active, .chip button:active, .editor-row .x:active {
  transform: scale(.95); filter: brightness(1.12);
}
.btn.big:active, .btn.block:active { transform: scale(.975); }
.shelf-card:active { transform: scale(.94); }
.link-btn:active { opacity: .6; }
.btn:active { opacity: 1; }
.btn.primary { box-shadow: 0 6px 18px rgba(255, 140, 26, .22); }
.btn.primary:active { box-shadow: 0 2px 8px rgba(255, 140, 26, .2); }
.row { transition: background-color .25s ease; }
.row:active { background: var(--card-2); transition-duration: 0s; }
.update-bar:active { filter: brightness(.95); }

/* Tabs: icon pops when chosen, label color fades */
.tabs button { transition: color .25s ease; }
.tabs button svg { transition: transform .35s var(--spring); }
.tabs button.active svg { transform: translateY(-1px) scale(1.12); }
.tabs button:active svg { transform: scale(.88); transition-duration: .1s; }

/* Page swaps: slide in from the side, rows ripple in */
#view.slide-right { animation: slideFromRight .34s var(--ease-out); }
#view.slide-left { animation: slideFromLeft .34s var(--ease-out); }
@keyframes slideFromRight { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes slideFromLeft { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
#view.enter .list > *, #view.enter > .card, #view.enter .shelf-card, #view.enter .empty { animation: rowIn .42s var(--ease-out) both; }
#view.enter .list > *:nth-child(2), #view.enter > .card:nth-of-type(2), #view.enter .shelf-card:nth-child(2) { animation-delay: .03s; }
#view.enter .list > *:nth-child(3), #view.enter > .card:nth-of-type(3), #view.enter .shelf-card:nth-child(3) { animation-delay: .06s; }
#view.enter .list > *:nth-child(4), #view.enter > .card:nth-of-type(4), #view.enter .shelf-card:nth-child(4) { animation-delay: .09s; }
#view.enter .list > *:nth-child(5) { animation-delay: .12s; }
#view.enter .list > *:nth-child(6) { animation-delay: .15s; }
#view.enter .list > *:nth-child(n+7) { animation-delay: .18s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#app.app-in { animation: appIn .4s var(--ease-out); }
@keyframes appIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.login { animation: appIn .45s var(--ease-out); }

/* Sheets: springy open, smooth close, content crossfades between pop-ups */
.sheet { animation: sheetUp .42s var(--spring); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet.no-anim { animation: none; }
.sheet.closing { animation: sheetDown .26s cubic-bezier(.4, 0, 1, 1) forwards; pointer-events: none; }
@keyframes sheetDown { from { transform: translateY(0); } to { transform: translateY(105%); } }
.backdrop { animation: fadeIn .3s ease; transition: opacity .25s ease; }
.backdrop.closing { animation: fadeOut .26s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
#sheetBody.swap { animation: swapIn .3s var(--ease-out); }
@keyframes swapIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Toggles: springy knob that stretches while pressed */
.switch span { transition: background-color .3s ease; }
.switch span::after { transition: transform .38s var(--spring), width .2s ease; }
.toggle-row:active .switch span::after, .setting:active .switch span::after { width: 33px; }
.switch input:checked + span::after { transform: translateX(20px); }
.toggle-row:active .switch input:checked + span::after, .setting:active .switch input:checked + span::after { transform: translateX(14px); }
.toggle-row { transition: background-color .25s ease; }
.toggle-row:active { background: rgba(255, 255, 255, .03); }

/* Chips & inputs */
.fchip { transition: transform .18s var(--spring), background-color .25s ease, color .25s ease, border-color .25s ease; }
.fchip.on { box-shadow: 0 4px 14px rgba(255, 159, 28, .25); }
input, select, textarea { transition: border-color .2s ease, box-shadow .2s ease; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(255, 159, 28, .15); }
.searchbar { transition: box-shadow .2s ease; }
.searchbar:focus-within { box-shadow: 0 0 0 2px rgba(255, 159, 28, .35); }
.check { transition: background-color .2s ease, border-color .2s ease, transform .25s var(--spring); }
.check.on { transform: scale(1.08); }
.row.selected { transition: background-color .2s ease; }
.bulk-bar { animation: barUp .35s var(--spring); }
@keyframes barUp { from { transform: translateY(140%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Images fade in instead of popping */
.fade-img { opacity: 0; transition: opacity .35s ease; }
.fade-img.loaded { opacity: 1; }

/* Toasts glide up and fade away */
.toast { animation: none; opacity: 0; transform: translate(-50%, 14px) scale(.96); transition: opacity .25s ease, transform .35s var(--spring); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.leaving { opacity: 0; transform: translate(-50%, 8px) scale(.98); }

/* Progress bars and rings move smoothly */
.bar > div { transition: width .45s var(--ease-out); }
.spinner { animation: spin .75s linear infinite; }

/* What's New sections open smoothly */
.wn summary { transition: background-color .2s ease; }
.wn summary:active { background: rgba(255, 255, 255, .03); }
.wn[open] .wn-summary, .wn[open] .wn-sec { animation: rowIn .35s var(--ease-out) both; }

/* ---------- install progress ---------- */
.install-wrap { text-align: center; padding: 4px 0 2px; }
.ring-wrap { position: relative; width: 132px; height: 132px; margin: 4px auto 6px; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-2); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--mango); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease-out), stroke .4s ease; }
.ring-icon { position: absolute; inset: 0; display: grid; place-items: center; }
.ring-icon .app-icon.big { width: 84px; height: 84px; border-radius: 20px; transition: transform .5s var(--spring); }
.ring-wrap.complete .ring-fg { stroke: var(--leaf); }
.ring-wrap.complete .ring-icon .app-icon.big { transform: scale(.92); }
.ring-check { position: absolute; right: 2px; bottom: 6px; width: 38px; height: 38px; border-radius: 50%; background: var(--leaf); display: grid; place-items: center; box-shadow: 0 0 0 4px var(--card); animation: pop .45s var(--spring); }
.ring-check svg { width: 22px; height: 22px; stroke: #0f2a0f; fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.install-pct { font-size: 30px; font-weight: 800; letter-spacing: -.5px; min-height: 36px; font-variant-numeric: tabular-nums; color: var(--mango); }
.install-wrap h2 { margin: 0 0 4px; }
.install-wrap .muted { margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.steps { list-style: none; padding: 0; margin: 4px auto 14px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; counter-reset: s; }
.steps li { counter-increment: s; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-2); border-radius: 999px; padding: 6px 10px 6px 8px; transition: background-color .3s ease, color .3s ease; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--card-2); margin-right: 6px; font-size: 11px; transition: background-color .3s ease, color .3s ease; }
.steps li.on { color: var(--text); }
.steps li.on::before { background: var(--leaf); color: #0f2a0f; content: '✓'; }
.steps li.now::before { background: var(--mango); color: #1a0d05; content: counter(s); animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 28, .5); } 50% { box-shadow: 0 0 0 5px rgba(255, 159, 28, 0); } }
.install-wrap .warning { text-align: left; }

/* People who turn on Reduce Motion get instant changes */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.ring-wrap.complete + .install-pct { color: var(--leaf); transition: color .4s ease; }

/* ---------- v1.3.0 themes ---------- */
html[data-theme="midnight"] {
  --bg: #0b1020; --bg-2: #121a30; --card: #161e36; --card-2: #1f2945; --line: rgba(255,255,255,.08);
  --text: #eef2ff; --muted: #94a0c2; --bg-fade: rgba(11,16,32,0); --card-fade: rgba(22,30,54,0);
  --tabbar: rgba(14,19,37,.9); --floating: rgba(31,41,69,.96); --icon-bg: #26315a; --switch-off: #2b3556; --soft-text: #cdd5f0;
}
html[data-theme="amoled"] {
  --bg: #000; --bg-2: #0c0c0c; --card: #111; --card-2: #1c1c1c; --line: rgba(255,255,255,.09);
  --text: #f5f5f5; --muted: #9a9a9a; --bg-fade: rgba(0,0,0,0); --card-fade: rgba(17,17,17,0);
  --tabbar: rgba(0,0,0,.9); --floating: rgba(28,28,28,.97); --icon-bg: #222; --switch-off: #2a2a2a; --soft-text: #d6d6d6;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f2ee; --bg-2: #ece6ef; --card: #ffffff; --card-2: #f1ecf4; --line: rgba(0,0,0,.08);
  --text: #1d1424; --muted: #7a6b86; --bg-fade: rgba(246,242,238,0); --card-fade: rgba(255,255,255,0);
  --tabbar: rgba(255,255,255,.88); --floating: rgba(255,255,255,.97); --icon-bg: #e4dcea; --switch-off: #d9d0e0; --soft-text: #463a52;
  --red: #e5384d;
}
html[data-theme="light"] .log { background: #241830; }
html[data-theme="light"] .warning { color: #9a6200; background: rgba(255, 179, 0, .14); }
html[data-theme="light"] .warning.bad { color: #b4232f; background: rgba(229, 56, 77, .1); }
html[data-theme="light"] .backdrop { background: rgba(30, 20, 40, .35); }
html[data-theme="light"] .toast { background: #1d1424; color: #fff; }
html[data-theme="light"] .toast.error { background: var(--red); }
html[data-accent="pink"] { --mango: #ff5fa2; --mango-2: #ff9ccc; --accent-2: #ff3d7f; }
html[data-accent="blue"] { --mango: #4c9dff; --mango-2: #8fc2ff; --accent-2: #2f7bff; }
html[data-accent="green"] { --mango: #3fcf8e; --mango-2: #8ee8bf; --accent-2: #1fb373; }
html[data-accent="purple"] { --mango: #a87bff; --mango-2: #cbb1ff; --accent-2: #8a55ff; }
html[data-accent="red"] { --mango: #ff5c5c; --mango-2: #ff9b9b; --accent-2: #f03a3a; }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-card { border: 2px solid transparent; background: var(--bg-2); border-radius: 14px; padding: 8px 6px 10px; display: grid; gap: 6px; justify-items: center; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; transition: border-color .2s ease, transform .18s var(--spring); }
.theme-card.on { border-color: var(--mango); }
.theme-card:active { transform: scale(.95); }
.theme-preview { width: 100%; aspect-ratio: 3 / 4; border-radius: 9px; padding: 6px; display: grid; gap: 4px; align-content: start; border: 1px solid var(--line); }
.theme-preview i { display: block; height: 12px; border-radius: 4px; }
.accent-row { display: flex; gap: 12px; flex-wrap: wrap; }
.accent { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--card); background: var(--c); box-shadow: 0 0 0 2px transparent; cursor: pointer; transition: box-shadow .2s ease, transform .18s var(--spring); }
.accent.on { box-shadow: 0 0 0 2px var(--c); }
.accent:active { transform: scale(.9); }
.seg { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 5px 10px; border-radius: 8px; font-size: 15px; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.seg button.on { background: var(--card-2); color: var(--text); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; padding: 10px; font-weight: 600; }

/* ---------- v1.3.0 library ---------- */
.row-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.row-badges .badge { font-size: 11px; padding: 2px 8px; }
.badge.new { background: linear-gradient(135deg, var(--mango), var(--accent-2)); color: var(--on-accent); font-weight: 800; letter-spacing: .3px; }
.tabs .dot.mango { background: var(--mango); }
.count.hot { background: var(--red); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 10px; padding: 4px 2px; }
.tile { border: 0; background: none; color: var(--text); display: grid; justify-items: center; gap: 4px; cursor: pointer; padding: 6px 2px; border-radius: 16px; transition: transform .18s var(--spring), background-color .2s ease; }
.tile:active { transform: scale(.92); background: var(--card); }
.tile-icon { position: relative; }
.tile .app-icon.big { width: 68px; height: 68px; border-radius: 16px; }
.tile-dot { position: absolute; top: -5px; right: -7px; font-style: normal; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 2px 6px; box-shadow: 0 0 0 2px var(--bg); }
.tile-dot.ok { background: var(--leaf); color: #0f2a0f; }
.tile-dot.up { background: var(--mango); color: var(--on-accent); }
.tile-dot.new { background: var(--mango); color: var(--on-accent); }
.tile-name { font-size: 13px; font-weight: 600; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.tile-sub { font-size: 11px; color: var(--muted); }
.col-card { justify-items: center; }
.col-emoji { font-size: 40px; width: 64px; height: 64px; display: grid; place-items: center; background: var(--bg-2); border-radius: 15px; }
.col-big { font-size: 40px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg-2); border-radius: 14px; margin: 4px 0 14px; padding: 10px 4px; }
.stat-row div { display: grid; justify-items: center; gap: 1px; text-align: center; }
.stat-row div + div { border-left: 1px solid var(--line); }
.stat-row b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: 11px; color: var(--muted); padding: 0 4px; }
.vote-row { display: flex; align-items: center; gap: 8px; margin: 16px 0 4px; }
.vote-row .muted { margin-right: auto; }
.vote { border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 999px; padding: 7px 13px; font-size: 15px; cursor: pointer; transition: transform .2s var(--spring), background-color .2s ease, border-color .2s ease; }
.vote b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.vote.on { background: rgba(92, 196, 92, .16); border-color: rgba(92, 196, 92, .5); }
.vote.down.on { background: rgba(255, 92, 108, .14); border-color: rgba(255, 92, 108, .45); }
.vote:active { transform: scale(.9); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.tag { border: 0; background: var(--card-2); color: var(--text); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .18s var(--spring); }
.tag.small { font-size: 12px; padding: 4px 9px; color: var(--muted); }
.tag:active { transform: scale(.92); }
.shots { display: flex; gap: 10px; overflow-x: auto; margin: 16px -18px 0; padding: 0 18px 4px; scroll-padding: 0 18px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.shots::-webkit-scrollbar { display: none; }
.shot { flex: none; border: 0; padding: 0; background: var(--bg-2); border-radius: 16px; overflow: hidden; scroll-snap-align: start; cursor: pointer; height: 300px; transition: transform .18s var(--spring); }
.shot:active { transform: scale(.97); }
.shot img { height: 100%; width: auto; display: block; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .94); animation: fadeIn .22s ease; display: flex; flex-direction: column; }
.viewer.out { animation: fadeOut .22s ease forwards; }
.viewer-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-slide { flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: center; padding: calc(env(safe-area-inset-top) + 50px) 16px calc(env(safe-area-inset-bottom) + 40px); box-sizing: border-box; }
.viewer-slide img { max-width: 100%; max-height: 100%; border-radius: 14px; object-fit: contain; }
.viewer-x { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 14px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 16px; cursor: pointer; }
.viewer-dots { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 16px); left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.viewer-dots i, .tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .3); transition: background-color .2s ease, width .25s var(--spring); }
.viewer-dots i.on, .tour-dots i.on { background: #fff; width: 18px; border-radius: 4px; }
.shot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.shot-edit { background: var(--bg-2); border-radius: 12px; overflow: hidden; display: grid; }
.shot-edit img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.shot-tools { display: flex; justify-content: space-between; padding: 6px; }
.shot-tools .mini { width: 30px; height: 30px; }
.mini-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 159, 28, .2); border-top-color: var(--mango); animation: spin .8s linear infinite; flex: none; }
.qr-box { background: #fff; border-radius: 18px; padding: 14px; width: min(260px, 80%); margin: 6px auto 12px; }
.qr-box img { width: 100%; height: auto; display: block; image-rendering: pixelated; }

/* ---------- announcements ---------- */
.announce { display: flex; align-items: flex-start; gap: 10px; border-radius: 14px; padding: 12px 12px 12px 14px; margin: 0 0 14px; background: rgba(76, 157, 255, .13); border: 1px solid rgba(76, 157, 255, .3); animation: rowIn .4s var(--ease-out); }
.announce.success { background: rgba(92, 196, 92, .13); border-color: rgba(92, 196, 92, .35); }
.announce.warning { background: rgba(255, 207, 74, .12); border-color: rgba(255, 207, 74, .35); }
.announce.party { background: linear-gradient(135deg, rgba(255, 159, 28, .18), rgba(255, 95, 162, .18)); border-color: rgba(255, 159, 28, .35); }
.announce.out { animation: fadeOut .22s ease forwards; }
.announce p { margin: 0; flex: 1; font-size: 14px; white-space: pre-wrap; }
.announce-icon { font-size: 18px; line-height: 1.2; }
.announce-x { border: 0; background: rgba(255, 255, 255, .1); color: var(--muted); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: none; font-size: 12px; }

/* ---------- tour ---------- */
.tour { text-align: center; padding: 6px 4px 0; }
.tour-emoji { font-size: 64px; margin: 6px 0 4px; animation: pop .5s var(--spring); }
.tour h2 { margin: 6px 0 8px; }
.tour p { margin: 0 auto 18px; max-width: 320px; font-size: 16px; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.tour-dots i { background: var(--card-2); }
.tour-dots i.on { background: var(--mango); }
#sheetBody.swap .tour-emoji { animation: pop .5s var(--spring); }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 80; }
.disk-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; font-size: 15px; color: var(--muted); }
.disk-head b { color: var(--text); font-size: 18px; }
.disk-head span { margin-left: auto; color: var(--leaf); font-weight: 600; font-size: 14px; }
.disk-head span.low { color: var(--red); }

/* ---------- V1.4 cloud library ---------- */
.badge.cloud { background: rgba(90, 160, 255, .15); color: #5aa0ff; }
.small-break { font-size: 12px; word-break: break-all; }
.ver-row { align-items: flex-start; }
.ver-row .pill { margin-top: 2px; }
.ver-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; margin-top: 4px; }
.gh-steps { margin: 4px 0 14px; padding-left: 22px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.gh-steps li { margin-bottom: 8px; }
.gh-steps b { color: var(--text); }
.see-all { margin: 8px 0 4px; }

/* ---------- V1.4.2 slimmer library ---------- */
.mini-shelf { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mini-shelf::-webkit-scrollbar { display: none; }
.mini-card { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: 0; padding: 0; color: var(--text); font: inherit; cursor: pointer; transition: transform .2s var(--spring, ease); }
.mini-card:active { transform: scale(.92); }
.mini-card .app-icon { width: 56px; height: 56px; border-radius: 14px; font-size: 22px; }
.mini-name { font-size: 11.5px; font-weight: 600; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 10.5px; color: var(--mango); margin-top: -3px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- V1.5 ---------- */
.chips-row.compact { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0 8px; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fopt { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; transition: transform .15s ease, background .2s ease; }
.fopt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt b { font-size: 12px; color: var(--muted); font-weight: 600; flex: none; }
.fopt.on { background: var(--mango); border-color: var(--mango); color: var(--on-accent, #1b1205); }
.fopt.on b { color: inherit; opacity: .75; }
.fopt:active { transform: scale(.96); }
.tw-icon { font-size: 24px; display: grid; place-items: center; }
.app-icon.big.tw-icon { font-size: 36px; }
.sub-card { margin-bottom: 12px; }
.sub-card .row-sub { margin-top: 4px; }
.pill.danger-pill { background: rgba(255, 92, 108, .16); color: var(--red); margin-left: 6px; }
.bulk-bar button.primary { background: var(--mango); color: var(--on-accent, #1b1205); }
.row-main > span.row-title, .row-main > span.row-sub { display: block; }
.fopt.zero { opacity: .55; }

/* ---------- V1.6 alerts & security ---------- */
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn.bell { position: relative; font-size: 19px; line-height: 1; }
.bell-dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: var(--red); color: #fff; font: 700 11px/18px -apple-system, system-ui, sans-serif; font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--bg); animation: pop .35s var(--spring, ease); }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }
.alert-row { align-items: flex-start; text-align: left; }
.alert-row.unread { background: rgba(255, 159, 28, .08); }
.alert-row.unread .row-title::after { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mango); margin-left: 8px; vertical-align: 2px; }
.alert-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 20px; border-radius: 10px; background: var(--card-2); }
.vote.fav { font-size: 18px; min-width: 44px; justify-content: center; }
.vote.fav.on { color: #ff5c8a; border-color: rgba(255, 92, 138, .5); background: rgba(255, 92, 138, .12); }

/* ---------- V1.7 owner tools ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid b { font-size: 22px; }
.stat-grid span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.chart { width: 100%; height: auto; display: block; }
.chart-lbl { fill: var(--muted); font-size: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rank { width: 22px; flex: none; color: var(--muted); font-weight: 700; text-align: center; }
.rule-card { margin-bottom: 10px; }
.rule-row { display: flex; gap: 8px; align-items: center; }
.rule-row select { flex: 1; min-width: 0; }

/* ---------- V1.7.2: full text, no "…" cut-offs ---------- */
/* In sheets and Settings, long lines (errors, file names, log messages) wrap instead of ending in "…". */
#sheetBody .row-title, #sheetBody .row-sub,
#view .list .setting, #view button.row .row-sub, #view button.row .row-title { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* Library rows keep their tidy one-line look. */
#libList .row-title, #libList .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
#addMsg, #addSub, #pSub, #trSub { overflow-wrap: anywhere; }
.log { max-height: 45vh; overflow-wrap: anywhere; word-break: normal; }
.job-cancel { color: var(--red); }
.link-btn.inline { display: inline; padding: 0; margin: 0 0 0 4px; font-size: inherit; }

/* ---------- V1.7.5 background tasks ---------- */
.task-pill {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + var(--safe-b, 0px)); z-index: 15;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 9px 16px 9px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text);
  font: 600 13px/1.2 inherit; box-shadow: 0 8px 26px rgba(0, 0, 0, .35); cursor: pointer;
}
.task-pill span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-pill .mini-spin { width: 18px; height: 18px; border-width: 2.5px; }
.task-row { align-items: flex-start; }
.task-row .bar { height: 6px; }

/* Installed-app fixes */
.bad-text { color: var(--red); }
.linkish { background: none; border: 0; color: var(--mango); font: inherit; font-size: 14px; padding: 6px 4px; cursor: pointer; }
.installed-note .note-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.hint-card { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--card); color: var(--soft-text); font-size: 14px; }
.hint-card span { flex: 1; }
.row-btns { display: flex; gap: 6px; flex-shrink: 0; }
.row-btns .small-btn { min-width: 36px; }
.btn.small-btn { padding: 7px 12px; font-size: 14px; border-radius: 10px; flex-shrink: 0; }
/* Version notes: 3 lines, tap to expand (sheet rows otherwise show everything, which made them overlap). */
#sheetBody .ver-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; cursor: pointer; }
#sheetBody .ver-notes.open { display: block; -webkit-line-clamp: unset; overflow: visible; }
.ver-row .row-main { min-width: 0; }
/* Duplicates: pick the copy to keep */
.dup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dup-head > span { min-width: 0; overflow-wrap: anywhere; }
.dup-head .link-btn.inline { flex-shrink: 0; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--mango); }
.dup-row.keeps { background: rgba(92, 196, 92, .07); }
.ver-big { font-size: 17px; font-weight: 700; }
/* Activity screen */
.act-card { display: flex; flex-direction: column; gap: 10px; margin: 0 0 4px; }
.act-card .card-actions { display: flex; gap: 8px; }
.act-card .card-actions .btn { flex: 1; }
.task-last { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; opacity: .85; }
.task-pill.done { border-color: rgba(92, 196, 92, .45); }
.pill-ok { width: 18px; text-align: center; color: var(--leaf); font-weight: 800; }
.hint-card .mini-spin { width: 16px; height: 16px; border-width: 2.5px; }

/* roles */
.badge.tester { background: rgba(106, 168, 255, .16); color: var(--blue); }

/* Sort by hand */
.sort-card { flex-wrap: wrap; }
.sort-card span { flex-basis: 100%; }
.sort-card .btn { flex: 1; }
.qs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.qs-grid .btn { padding: 12px 8px; font-size: 15px; }
.btn .qs-why { display: block; font-size: 12px; font-weight: 500; opacity: .8; margin-top: 2px; }

/* Numbered how-to steps */
.howto { margin: 4px 0 14px; padding-left: 22px; color: var(--soft-text); font-size: 15px; line-height: 1.5; }
.howto li { margin-bottom: 6px; }
