:root {
  --bg: #2f3c45; --bg2: #26323a; --card: #3a4852; --text: #fff; --muted: #a9b6bf;
  --coral: #ef6a6e; --coral-d: #d9575b; --green: #4fb98a; --amber: #f2b552; --chip: #46555f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font-family: inherit; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(16px + env(safe-area-inset-top)) 0 10px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 22px; margin: 0; }
.sync { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 4px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--green); } .dot.offline { background: var(--coral); }
.avatars { display: flex; margin-left: 2px; }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; border: 2px solid var(--bg); }
.av + .av { margin-left: -8px; }

.add { display: flex; gap: 8px; margin-top: 12px; }
.add input, .field { flex: 1; min-width: 0; background: var(--card); border: 0; border-radius: 12px; padding: 12px 14px; color: var(--text); font-size: 16px; outline: none; }
.add button, .btn { background: var(--coral); color: #fff; border: 0; border-radius: 12px; padding: 0 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn { padding: 10px 14px; }
.btn.green { background: var(--green); } .btn.ghost { background: var(--chip); } .btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }

h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--coral); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; padding: 6px; text-align: center; transition: transform .12s, opacity .2s; touch-action: manipulation; }
.tile:active { transform: scale(.94); }
.tile.home { background: var(--green); }
.tile.recent { background: var(--card); }
.tile.gone { opacity: 0; }
.tile .ic { font-size: 38px; line-height: 1; }
.tile .ic.letter { font-size: 40px; font-weight: 800; font-family: Georgia, serif; }
.tile .nm { font-size: 14px; font-weight: 600; line-height: 1.15; hyphens: auto; overflow-wrap: anywhere; }
.tile .by { font-size: 10px; opacity: .8; }
.badge { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.85); color: var(--coral-d); font-size: 10px; font-weight: 800; padding: 2px 5px; border-radius: 5px; }

.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center; background: var(--bg2); border-radius: 12px; line-height: 1.4; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.35; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border-radius: 999px; padding: 5px 10px; font-size: 13px; border: 0; color: var(--text); }
button.chip { cursor: pointer; }
.chip.have { background: rgba(79,185,138,.25); color: #bdf0d6; }
.chip.miss { background: rgba(239,106,110,.25); color: #ffd0d1; }
.chip.onlist { background: rgba(242,181,82,.25); color: #ffe2ad; }
.chip.staple { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.chip .x { opacity: .6; }
.row { display: flex; gap: 8px; margin-top: 10px; }

.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.card .t { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { margin: 0; font-size: 17px; }
.card .chips { margin-top: 10px; }
.acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--green); } .pill.al { background: var(--amber); color: #3b2a06; } .pill.no { background: var(--chip); }
.form .field { width: 100%; background: var(--bg2); margin-bottom: 8px; font-size: 15px; }

nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--bg2); display: flex; justify-content: center; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
nav .in { display: flex; max-width: 480px; width: 100%; }
nav button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 11px; padding: 6px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav button .i { font-size: 22px; filter: grayscale(1); opacity: .7; }
nav button.on { color: #fff; } nav button.on .i { filter: none; opacity: 1; }
nav .cnt { background: var(--coral); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; margin-left: 2px; }
nav .cnt:empty { display: none; }

.toast { position: fixed; z-index: 8; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #111a20; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: .2s; width: max-content; max-width: min(448px, calc(100% - 32px)); }
.toast span { flex: 1; }
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--amber); font-weight: 700; font-size: 14px; cursor: pointer; }

.update { position: fixed; z-index: 9; top: 0; left: 0; right: 0; background: var(--amber); color: #3b2a06; display: flex; justify-content: center; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; font-size: 14px; font-weight: 600; }
.update button { background: #3b2a06; color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }

.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(15,22,27,.85); display: grid; place-items: center; padding: 16px; }
.dlg { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.dlg h3 { margin: 0; font-size: 19px; }
.dlg input { background: var(--bg2); border: 0; border-radius: 10px; padding: 12px; color: var(--text); font-size: 16px; outline: none; }
.dlg .btn { padding: 12px; }

.foot { font-size: 11px; color: var(--muted); text-align: center; margin-top: 28px; }
