/* MiwNews — estilos */
:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-soft: #dbeafe; --good: #16a34a; --bad: #dc2626; --warn-bg: #fff7ed; --warn: #9a3412;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
  --reader-size: 19px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Iowan Old Style", Georgia, Cambria, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --card: #111a2e; --text: #e5e7eb; --muted: #94a3b8; --line: #1f2a44;
    --accent: #60a5fa; --accent-soft: #1e3a8a55; --warn-bg: #3b2410; --warn: #fdba74; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --card: #111a2e; --text: #e5e7eb; --muted: #94a3b8; --line: #1f2a44;
  --accent: #60a5fa; --accent-soft: #1e3a8a55; --warn-bg: #3b2410; --warn: #fdba74; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.45; padding-bottom: 72px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.6rem; margin: .3em 0 .6em; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--bad); }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.mainnav a.on, .mainnav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.topactions { display: flex; gap: 6px; margin-left: auto; }
.iconbtn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; padding: 0 8px; }
.iconbtn:hover { text-decoration: none; border-color: var(--accent); }
.bottomnav { display: none; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 18px; }

/* Modo sin imágenes */
.iconbtn.on { background: var(--accent-soft); border-color: var(--accent); }
html.noimg .news .thumb, html.noimg .reader .content img, html.noimg .reader .lead { display: none !important; }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.ghost { background: transparent; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 40px; }
label { display: block; font-size: .9rem; font-weight: 600; margin: 0 0 12px; }
label input, label select { margin-top: 5px; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; resize: vertical; }
.inline { display: inline; }
.frow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.frow > label { flex: 1 1 160px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-size: .95rem; }
.alert.ok { background: #dcfce7; color: #14532d; }
.alert.err { background: #fee2e2; color: #7f1d1d; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* Barra de filtros */
.toolbar { margin-bottom: 8px; }
.searchrow { display: flex; gap: 8px; }
.searchrow input { flex: 1; }
.morefilters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.srcpick { margin: 6px 0 12px; }
.srcpick-head { margin-bottom: 6px; }
.srcgroup { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; width: 100%; }
.srcchip { display: inline-block; margin: 0 4px 6px 0; font-weight: 500; }
.srcchip input { display: none; }
.srcchip span { display: inline-block; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-size: .85rem; }
.srcchip input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: none; padding: 6px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: .9rem; font-weight: 500; }
.cats a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.cats a:hover { text-decoration: none; border-color: var(--accent); }
.statusline { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .85rem; margin: 6px 2px 14px; }

/* Tarjetas de noticias */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.news { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin: 0; transition: opacity .2s; }
.news .thumb { display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--line); }
.news .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news .body { padding: 14px 16px 12px; display: flex; flex-direction: column; flex: 1; }
.news h2 { font-size: 1.08rem; line-height: 1.3; margin: 6px 0 6px; letter-spacing: -.01em; }
.news h2 a { color: var(--text); }
.news .summary { color: var(--muted); font-size: .92rem; margin: 0 0 10px; }
.news.read h2 a { color: var(--muted); font-weight: 600; }
.news.read .thumb { opacity: .65; }
.news.hero { grid-column: 1 / -1; flex-direction: row; }
.news.hero .thumb { flex: 0 0 55%; aspect-ratio: auto; min-height: 320px; }
.news.hero .body { padding: 22px 24px; justify-content: center; }
.news.hero h2 { font-size: 1.6rem; }
.news.hero .summary { font-size: 1rem; }
.news.gone { opacity: .25; pointer-events: none; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); }
.src { display: inline-block; background: var(--c, #64748b); color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: .75rem; letter-spacing: .01em; }
.src.small { font-size: .72rem; padding: 2px 7px; margin: 0 3px 3px 0; }
a.src:hover { text-decoration: none; filter: brightness(1.15); }
.cat { text-transform: uppercase; letter-spacing: .05em; font-weight: 600; font-size: .7rem; }
.also { font-size: .8rem; color: var(--muted); margin: 0 0 10px; }
.also-label { margin-right: 4px; }
.actions { display: flex; align-items: center; gap: 4px; margin-top: auto; flex-wrap: wrap; }
.act { background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: .95rem; filter: grayscale(1); opacity: .65; color: var(--text); font-family: inherit; }
.act:hover { background: var(--bg); opacity: 1; filter: none; text-decoration: none; }
.act.on { filter: none; opacity: 1; background: var(--accent-soft); }
.why { margin-left: auto; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 24px 0; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; }

/* Lector */
.reader { max-width: 720px; margin: 0 auto; }
.reader-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.fontctl { display: flex; gap: 6px; }
.reader h1 { font-family: var(--serif); font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.15; letter-spacing: -.01em; margin: 12px 0 18px; }
.reader .lead { margin: 0 0 20px; }
.reader .lead img { width: 100%; border-radius: 12px; }
.reader .content { font-family: var(--serif); font-size: var(--reader-size); line-height: 1.68; overflow-wrap: break-word; }
.reader .content p { margin: 0 0 1.05em; }
.reader .content h2, .reader .content h3 { font-family: var(--font); margin: 1.4em 0 .5em; }
.reader .content img { display: block; margin: 1.2em auto .4em; border-radius: 10px; }
.reader .content figure { margin: 1.3em 0; }
.reader .content figcaption { font-family: var(--font); font-size: .8rem; color: var(--muted); text-align: center; }
.reader .content blockquote { border-left: 3px solid var(--accent); margin: 1.2em 0; padding: .2em 0 .2em 1em; color: var(--muted); font-style: italic; }
.reader .content table { border-collapse: collapse; width: 100%; font-size: .85em; font-family: var(--font); display: block; overflow-x: auto; }
.reader .content td, .reader .content th { border: 1px solid var(--line); padding: 6px; }
.reader-actions { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin: 26px 0; gap: 8px; }
.reader-actions .act { border-color: var(--line); filter: none; opacity: 1; font-size: .9rem; padding: 8px 12px; }
.coverage h2 { margin-top: 0; }
.coverage ul { list-style: none; padding: 0; margin: 0; }
.coverage li { padding: 9px 0; border-top: 1px solid var(--line); }
.coverage li:first-child { border-top: 0; }
.coverage li.read a { color: var(--muted); }
.coverage time { color: var(--muted); font-size: .8rem; }

/* Fuentes y ajustes */
.srcgroup-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 0 8px; }
.source { padding: 12px 16px; margin-bottom: 8px; }
.source.off { opacity: .55; }
.source summary { cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; list-style: none; }
.source summary::-webkit-details-marker { display: none; }
.source form { margin-top: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--good); } .dot.red { background: var(--bad); } .dot.grey { background: var(--muted); }
.addform { max-width: 560px; margin-top: 12px; }
details.card > summary { cursor: pointer; }
.log { background: var(--bg); border-radius: 10px; padding: 12px; max-height: 320px; overflow: auto; font-size: .8rem; white-space: pre-wrap; }
.interests { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.interests h3 { font-size: .95rem; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; margin: 0 4px 6px 0; font-size: .85rem; }
.tag.good { background: #dcfce7; color: #14532d; }
.tag.bad { background: #fee2e2; color: #7f1d1d; }

/* Login / instalador */
.center-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 360px; text-align: center; }
.login label { text-align: left; }
.login .btn { width: 100%; margin-top: 6px; }
.install { width: 100%; max-width: 640px; }
.install h1 { display: flex; align-items: center; gap: 10px; }
.checks { list-style: none; padding: 0; }
.checks .ok { color: var(--good); } .checks .bad { color: var(--bad); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px;
  border-radius: 10px; font-size: .9rem; z-index: 50; box-shadow: var(--shadow); }

/* Móvil */
@media (max-width: 760px) {
  .mainnav { display: none; }
  .topbar { padding: 8px 12px; }
  .wrap { padding: 12px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { flex: 1; text-align: center; padding: 8px 2px; font-size: .8rem; font-weight: 600; color: var(--muted); border-radius: 8px; }
  .bottomnav a.on { color: var(--accent); background: var(--accent-soft); }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .news.hero { flex-direction: column; }
  .news.hero .thumb { flex: none; min-height: 0; aspect-ratio: 16/9; }
  .news.hero .body { padding: 14px 16px 12px; }
  .news.hero h2 { font-size: 1.3rem; }
  .searchrow .btn.primary { display: none; }
  .interests { grid-template-columns: 1fr; }
  .why { max-width: 100%; margin-left: 0; width: 100%; }
}
