:root {
  --bg: #f4f6f7; --card: #fff; --fg: #14181b; --mut: #66737b; --acc: #0f766e; --acc-fg: #fff; --bd: #e1e6e9; --sb: 290px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1113; --card: #161a1d; --fg: #e8ecee; --mut: #8a969e; --acc: #2dd4bf; --acc-fg: #04201c; --bd: #252b2f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button, .btn { color: inherit; cursor: pointer; background: none; border: 1px solid var(--bd); border-radius: 8px; padding: .45rem .75rem; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--mut); }
button.primary { background: var(--acc); color: var(--acc-fg); border-color: var(--acc); font-weight: 600; }
input[type=text], input[type=password] { width: 100%; padding: .6rem .75rem; border: 1px solid var(--bd); border-radius: 8px; background: var(--card); }

/* login */
#login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 1.5rem; width: min(360px, 100%); display: grid; gap: .8rem; }
.card h1 { margin: 0 0 .25rem; font-size: 1.4rem; }
.err { color: #dc2626; margin: 0; font-size: .9rem; }

/* header */
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; padding: calc(.5rem + env(safe-area-inset-top)) .75rem .5rem; background: var(--card); border-bottom: 1px solid var(--bd); }
header h1 { flex: 1; margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header button { border: 0; font-size: 1.25rem; padding: .3rem .6rem; }
#refresh.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* drawer */
#drawer { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(var(--sb), 86vw); background: var(--card); border-right: 1px solid var(--bd); transform: translateX(-100%); transition: transform .2s; display: flex; flex-direction: column; padding: calc(.5rem + env(safe-area-inset-top)) .5rem .5rem; gap: .5rem; }
body.open #drawer { transform: none; }
#scrim { position: fixed; inset: 0; z-index: 10; background: #0006; display: none; }
body.open #scrim { display: block; }
#feeds { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.f { display: flex; align-items: center; gap: .25rem; border-radius: 8px; }
.f.on { background: color-mix(in srgb, var(--acc) 16%, transparent); }
.f > button.sel { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: .5rem; border: 0; text-align: left; padding: .5rem .6rem; }
.f .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f .c { color: var(--mut); font-variant-numeric: tabular-nums; }
.f .x { border: 0; color: var(--mut); padding: .3rem .5rem; opacity: .6; }
.f.bad .n::after { content: " ⚠"; }
#add-form { display: grid; gap: .4rem; }
.tools { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .9rem; }

/* conteúdo */
main { max-width: 760px; margin: 0 auto; padding: .75rem .75rem calc(2rem + env(safe-area-inset-bottom)); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--bd); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--acc); color: var(--acc-fg); }
#markall { font-size: .9rem; }
#list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.item { background: var(--card); border: 1px solid var(--bd); border-radius: 12px; padding: .75rem .9rem; }
.item .row { display: flex; gap: .5rem; align-items: flex-start; }
.item a.t { flex: 1; font-weight: 600; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.item a.t:hover { text-decoration: underline; }
.item .tog { border: 0; padding: .1rem .4rem; color: var(--acc); }
.item .meta { color: var(--mut); font-size: .85rem; margin-top: .15rem; }
.item .s { margin: .4rem 0 0; color: var(--mut); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item.read { opacity: .55; }
.item.read .tog { color: var(--mut); }
.item.read a.t { font-weight: 400; }
#more { display: block; margin: 1rem auto; }
#empty { text-align: center; color: var(--mut); padding: 2rem 0; }
#toast { position: fixed; z-index: 50; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; max-width: 90vw; font-size: .9rem; }

@media (min-width: 900px) {
  #drawer { transform: none; }
  #menu, #scrim { display: none !important; }
  #app { padding-left: var(--sb); }
  body.open #scrim { display: none; }
}
