:root {
  --blue: #1a73e8; --blue-soft: #e8f0fe; --red: #d93025; --text: #202124;
  --muted: #5f6368; --border: #dadce0; --bg: #f1f3f4; --card: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
body.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0; }

/* Botones */
.btn { border: 0; border-radius: 20px; padding: 9px 18px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: #1765cc; }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { background: var(--red); color: #fff; }
.btn.full { width: 100%; margin-top: 8px; }
.icon-btn { border: 0; background: transparent; font-size: 18px; cursor: pointer; opacity: .35; padding: 6px; border-radius: 50%; }
.icon-btn:hover { opacity: 1; background: #fce8e6; }

input, select { width: 100%; padding: 11px 12px; font-size: 15px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-family: inherit; }
input:focus, select:focus { outline: 2px solid var(--blue); border-color: transparent; }

/* Login */
.login-card { background: var(--card); width: min(380px, 92vw); padding: 32px; border-radius: 14px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 6px 20px rgba(0,0,0,.06); }
.login-card h1 { font-size: 22px; font-weight: 500; margin: 6px 0 4px; }
.login-card input { margin-top: 18px; }
.logo { font-size: 36px; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; gap: 16px; align-items: center; padding: 12px 24px; }
.brand { font-size: 20px; font-weight: 500; white-space: nowrap; }
.topbar input[type=search] { max-width: 420px; border-radius: 22px; background: var(--bg); border-color: transparent; }
.actions { margin-left: auto; display: flex; gap: 8px; }

main { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.status { color: var(--red); font-size: 13px; margin-bottom: 10px; }

/* Lista estilo Authenticator */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #f1f3f4; }
.item:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.info { flex: 1; min-width: 0; }
.name { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; overflow: hidden; }
.name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: #e6f4ea; color: #137333; font-size: 11px; font-weight: 600; text-transform: uppercase;
  padding: 2px 8px; border-radius: 10px; letter-spacing: .5px; }
.code { font-family: Consolas, "Roboto Mono", monospace; font-size: 34px; color: var(--blue); letter-spacing: 3px;
  cursor: pointer; margin-top: 2px; transition: color .3s; user-select: none; }
.code.urgent { color: var(--red); }
.code.err { font-size: 13px; color: var(--red); letter-spacing: 0; font-family: inherit; cursor: default; }

.timer { width: 40px; height: 40px; flex-shrink: 0; }
.timer .track { fill: none; stroke: #e8eaed; stroke-width: 4; }
.timer .bar { fill: none; stroke: var(--blue); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.timer.urgent .bar { stroke: var(--red); }
.timer .secs { font-size: 11px; fill: var(--muted); font-family: inherit; }

.empty { text-align: center; padding: 48px 16px; background: var(--card); border-radius: 12px; }

/* Diálogos */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, 92vw); box-shadow: 0 8px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(32,33,36,.5); }
dialog form { padding: 24px; }
dialog h2 { font-size: 18px; font-weight: 500; margin: 0 0 16px; }
dialog label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
dialog label input, dialog label select { margin-top: 6px; color: var(--text); }
dialog label.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
dialog label.check input { width: auto; margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: #323232; color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; opacity: 0; transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 12px; }
  .topbar input[type=search] { order: 3; max-width: none; }
  .code { font-size: 28px; }
}

/* Botones de cada fila */
.row-btns { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn.edit:hover { background: var(--blue-soft); }
.desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.small { padding: 6px 12px; font-size: 13px; margin-top: 6px; }

/* Pestañas QR / key */
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 22px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 18px; font-size: 13px; cursor: pointer; color: var(--muted); font-family: inherit; }
.tab.active { background: var(--card); color: var(--blue); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* Lector de QR */
.qr-box { border: 2px dashed var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; background: #fafafa; }
.qr-idle { padding: 22px 16px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.qr-idle p { margin: 4px 0 0; }
.qr-box video { display: block; width: 100%; max-height: 300px; object-fit: cover; background: #000; }
.qr-ok { background: #e6f4ea; color: #137333; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.qr-ok .muted { margin-top: 4px; }

.opt { color: #9aa0a6; font-size: 12px; }
.note { font-size: 12px; color: var(--muted); background: var(--bg); padding: 8px 10px; border-radius: 8px; margin: 0 0 10px; }
.note.warn { background: #fef7e0; color: #8a5300; }
