:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #17171a;
  --muted: #6b6b73;
  --line: #e6e4df;
  --accent: #e5452f;
  --accent-ink: #ffffff;
  --ok: #1f7a4d;
  --err: #b42318;
  --radius: 14px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#111113; --surface:#1a1a1d; --ink:#f1f0ed; --muted:#9a9aa3; --line:#2a2a2f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: inherit; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; margin: 0 0 .25rem; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 2rem 0 .75rem; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
[hidden] { display: none !important; }

/* Cabecera */
.top { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding: .9rem clamp(16px,4vw,40px); border-bottom:1px solid var(--line); background: var(--surface); position: sticky; top:0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; display:flex; align-items:center; gap:.55rem; letter-spacing:-.01em; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display:inline-block; }
.top nav { display:flex; align-items:center; gap: 1.1rem; font-size: .92rem; }
.top nav a { text-decoration:none; color: var(--muted); } .top nav a:hover { color: var(--ink); }
.user { display:flex; align-items:center; gap:.45rem; color: var(--muted); }
.user img { width: 26px; height: 26px; border-radius: 50%; }
.top form { margin: 0; }
button.link { background:none; border:0; padding:0; color: var(--muted); cursor:pointer; font: inherit; }
button.link:hover { color: var(--ink); }
@media (max-width: 640px) { .user { display:none; } .top nav { gap:.8rem; } }

/* Contenido */
.wrap { max-width: 1080px; margin: 0 auto; padding: 2rem clamp(16px,4vw,40px) 4rem; }
.hello p { color: var(--muted); margin: 0 0 1.25rem; }
input[type=search] { width: 100%; max-width: 420px; }

.grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display:flex; align-items:flex-start; gap: .9rem; padding: 1rem 1.1rem; background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); text-decoration:none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .icon { flex: 0 0 42px; height: 42px; border-radius: 10px; background: var(--bg); display:grid; place-items:center; font-size: 1.3rem; font-weight: 700; }
.card .body { flex:1; min-width:0; display:flex; flex-direction:column; gap:.15rem; }
.card .name { font-weight: 600; }
.card .desc { color: var(--muted); font-size: .88rem; }
.card .go { color: var(--muted); } .card:hover .go { color: var(--accent); }
.tag { font-style: normal; font-size: .7rem; font-weight:600; background: #fff1d6; color: #8a5a00; padding: .05rem .4rem; border-radius: 6px; vertical-align: middle; }
.empty { margin-top: 2rem; padding: 2.5rem; text-align:center; border:1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* Formularios y botones */
input, select { font: inherit; color: inherit; background: var(--surface); border:1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btn { display:inline-block; background: var(--accent); color: var(--accent-ink); border:0; border-radius: 10px; padding: .65rem 1.1rem; font: inherit; font-weight:600; cursor:pointer; text-decoration:none; }
.btn:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.flash { padding: .7rem 1rem; border-radius: 10px; margin: 0 0 1.25rem; font-size: .92rem; }
.flash.ok { background: #e7f5ee; color: var(--ok); }
.flash.error { background: #fdecea; color: var(--err); }

/* Login */
.center { min-height: 100vh; display:grid; place-items:center; padding: 16px; }
.login { width: 100%; max-width: 380px; background: var(--surface); border:1px solid var(--line); border-radius: 20px; padding: 2.5rem 2rem; text-align:center; }
.login .mark { display:flex; justify-content:center; margin-bottom: 1rem; }
.login .mark .dot { width: 22px; height: 22px; }
.login h1 { font-size: 1.4rem; }
.login > p.muted { margin: 0 0 1.5rem; }
.google { display:flex; align-items:center; justify-content:center; gap:.65rem; padding:.75rem 1rem; border:1px solid var(--line); border-radius: 12px; text-decoration:none; font-weight:600; background: var(--surface); }
.google:hover { border-color: var(--ink); }
.hint { font-size: .82rem; color: var(--muted); margin: .75rem 0 0; }
.dev { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px dashed var(--line); display:grid; gap:.5rem; font-size:.85rem; }
.dev p { margin: 0; color: var(--muted); }

/* Admin */
.seg { border:0; padding:0; margin:0; display:flex; gap:.5rem; flex-wrap:wrap; }
.seg legend { font-size:.88rem; font-weight:600; margin-bottom:.35rem; padding:0; }
.form .seg label { display:flex; align-items:center; gap:.45rem; font-weight:400; border:1px solid var(--line); border-radius:10px; padding:.5rem .8rem; cursor:pointer; }
.form .seg label:has(input:checked) { border-color: var(--accent); }
.seg input { width:auto; accent-color: var(--accent); }
.panel + .panel { margin-top: 1.5rem; }
.prefixed { display:flex; align-items:stretch; border:1px solid var(--line); border-radius: 10px; background: var(--surface); overflow:hidden; font-weight: 400; }
.prefixed:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.prefixed .prefix { display:flex; align-items:center; padding: 0 .6rem; color: var(--muted); background: var(--bg); font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }
.prefixed input { border:0; border-radius:0; outline:none; font-family: ui-monospace, Menlo, monospace; font-size: .92rem; min-width: 0; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }
.inline-add { display:flex; gap:.5rem; max-width: 520px; margin-bottom: 1rem; }
.inline-add .btn { white-space: nowrap; }
.rename { display:flex; gap:.4rem; align-items:center; margin:0; }
.rename input { padding: .4rem .6rem; max-width: 260px; }
.list.cats td:first-child { width: 60%; }
.panel { background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.panel .head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.back { text-decoration:none; color: var(--muted); font-size:.9rem; display:inline-block; margin-bottom:.75rem; }
.form { display:grid; gap: 1rem; max-width: 640px; margin-top: 1rem; }
.form label { display:grid; gap:.35rem; font-size:.88rem; font-weight:600; }
.form small { font-weight: 400; color: var(--muted); }
.form .row { display:flex; gap: 1rem; flex-wrap: wrap; }
.form .grow { flex: 1; min-width: 200px; }
.icon-field { width: 90px; } .icon-field input { text-align:center; font-size: 1.2rem; }
.form .check { display:flex; align-items:center; gap:.5rem; font-weight: 400; }
.form .check input { width:auto; }
.list { width:100%; border-collapse: collapse; font-size: .92rem; }
.list th { text-align:left; font-size:.75rem; text-transform: uppercase; letter-spacing:.06em; color: var(--muted); font-weight:600; padding:.5rem; border-bottom:1px solid var(--line); }
.list td { padding: .7rem .5rem; border-bottom:1px solid var(--line); vertical-align: middle; }
.icon-cell { font-size: 1.3rem; width: 40px; text-align:center; }
.ops { white-space: nowrap; text-align:right; }
.ops form { display:inline; margin:0; }
.mini { font: inherit; font-size:.82rem; background: transparent; border:1px solid var(--line); border-radius: 8px; padding: .25rem .55rem; cursor:pointer; text-decoration:none; color: var(--ink); display:inline-block; }
.mini:hover:not(:disabled) { border-color: var(--ink); }
.mini:disabled { opacity: .35; cursor: default; }
.mini.danger { color: var(--err); }
.pill { font-size:.75rem; padding:.15rem .5rem; border-radius: 999px; background: var(--bg); }
.pill.activa { background:#e7f5ee; color: var(--ok); }
.pill.privada { background:#fff1d6; color:#8a5a00; }
.pill.inactiva { color: var(--muted); }
@media (max-width: 720px) {
  .list thead { display:none; }
  .list tr { display:grid; grid-template-columns: 40px 1fr; padding: .6rem 0; border-bottom:1px solid var(--line); }
  .list td { border:0; padding: .2rem .5rem; }
  .list td:nth-child(3), .list td:nth-child(4) { grid-column: 2; }
  .ops { grid-column: 1 / -1; text-align:left; padding-top:.5rem !important; }
}
