/* SERED Hub - vista principal */

/* Buscador global */
.search {
    position: relative; flex: 1; max-width: 560px; display: flex; align-items: center;
}
.search .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search input {
    width: 100%; height: 40px; padding: 0 70px 0 40px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-size: 14px;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::placeholder { color: var(--text-3); }
.search kbd { position: absolute; right: 10px; }
.search .clear { position: absolute; right: 6px; width: 28px; height: 28px; }

/* Selector Herramientas / Recursos */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--bg-soft); border-radius: 10px; margin-bottom: 8px; }
.segmented button {
    display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; border-radius: 8px;
    background: transparent; color: var(--text-2); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; padding: 0 4px;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Secciones */
.section { margin-bottom: 34px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); font-size: 20px; flex: none; box-shadow: var(--shadow-sm); }
.section-head h2 { font-size: 18px; font-weight: 750; }
.section-head .rich { font-size: 13px; color: var(--text-3); margin-top: 1px; }
.section-head .rich p { margin: 0; }
.section-head .count { margin-left: auto; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }

.group { margin-bottom: 20px; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 10px 2px; }
.group-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Tarjetas de herramienta */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.tool-card {
    position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0;
    padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-top { display: flex; align-items: flex-start; gap: 12px; }
.tool-avatar {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px;
    font-weight: 800; font-size: 15px; color: hsl(var(--h) 60% 38%); background: hsl(var(--h) 80% 94%);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tool-avatar { color: hsl(var(--h) 80% 78%); background: hsl(var(--h) 40% 20%); } }
:root[data-theme="dark"] .tool-avatar { color: hsl(var(--h) 80% 78%); background: hsl(var(--h) 40% 20%); }
.tool-titles { flex: 1; min-width: 0; }
.tool-titles h3 { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.tool-domain { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-path { font-size: 11.5px; color: var(--text-3); }
.fav-btn { width: 30px; height: 30px; margin: -4px -6px 0 0; font-size: 17px; color: var(--text-3); }
.fav-btn.on { color: #f5a524; }
.tool-desc { position: relative; max-height: 4.65em; overflow: hidden; cursor: pointer; }
.tool-desc.clamped::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.6em; background: linear-gradient(transparent, var(--surface)); }
.tool-desc.open { max-height: none; }
.tool-desc.open::after { display: none; }
.tool-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.tool-actions .btn { flex: 1; }

mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark { background: #6b5613; } }

/* Recursos */
.res-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.res-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.res-item:last-child { border-bottom: 0; }
.res-item:hover { background: var(--surface-2); }
.res-ext { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 10px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent-text); }
.res-ext.link { font-size: 18px; }
.res-info { flex: 1; min-width: 0; }
.res-name { font-weight: 650; }
.res-meta { font-size: 12px; color: var(--text-3); }
.res-info .rich { font-size: 12.5px; margin-top: 2px; }

/* Resumen de apartados (portada) */
.overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 32px; }
.overview-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.overview-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.overview-card .section-icon { width: 38px; height: 38px; box-shadow: none; background: var(--bg-soft); border: 0; }
.overview-card strong { display: block; font-size: 14px; }
.overview-card small { color: var(--text-3); }

/* Credenciales */
.cred-list { display: flex; flex-direction: column; gap: 10px; }
.cred-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.cred-row .cred-label { width: 110px; flex: none; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; overflow-wrap: anywhere; }
.cred-row .cred-value { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; overflow-wrap: anywhere; }
.cred-row .btn-xs { flex: none; }

/* Consultas rápidas (inicio) */
.lookup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.lookup-card { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border-top: 3px solid var(--accent); }
.lookup-head { display: flex; align-items: center; gap: 12px; }
.lookup-head .section-icon { width: 36px; height: 36px; font-size: 18px; box-shadow: none; background: var(--bg-soft); border: 0; }
.lookup-head h3 { font-size: 15px; font-weight: 700; }
.lookup-head small { color: var(--text-3); font-size: 12.5px; }
.lookup-row { display: flex; gap: 8px; }
.lookup-row .input { flex: 1; min-width: 0; height: 38px; }
.lookup-row .btn { height: 38px; flex: none; }

.lk-tabs { display: flex; gap: 4px; padding: 10px 22px 0; border-bottom: 1px solid var(--border); }
.lk-tabs button { border: 0; background: none; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.lk-tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.lookup-wait { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 0; color: var(--text-3); text-align: center; }
.lookup-error { padding: 16px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-weight: 500; overflow-wrap: anywhere; }

.lk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.lk-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); border-left: 3px solid var(--lk-c, var(--accent)); min-width: 0; }
.lk-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.lk-stat strong { font-size: 16px; color: var(--lk-c, var(--text)); overflow-wrap: anywhere; }
.lk-stat small { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.lk-section { margin-bottom: 18px; }
.lk-section:last-child { margin-bottom: 0; }
.lk-section h4 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.lk-rows { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lk-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 9px 14px; align-items: start; }
.lk-row:nth-child(even) { background: var(--surface-2); }
.lk-label { font-size: 13px; color: var(--text-3); padding-top: 2px; }
.lk-value { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.lk-val { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 13.5px; color: var(--lk-c, var(--text)); }
.lk-val.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-size: 12.5px; }
.lk-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--lk-c); background: var(--lk-bg); }
.lk-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lk-copy { width: 26px; height: 26px; flex: none; margin-left: auto; opacity: .5; }
.lk-row:hover .lk-copy { opacity: 1; }
.t-ok { --lk-c: var(--success); --lk-bg: var(--success-soft); }
.t-warn { --lk-c: var(--warning); --lk-bg: var(--warning-soft); }
.t-bad { --lk-c: var(--danger); --lk-bg: var(--danger-soft); }
.t-info { --lk-c: var(--accent-text); --lk-bg: var(--accent-soft); }
.t-muted { --lk-c: var(--text-3); --lk-bg: var(--bg-soft); }

.lk-capture { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); padding: 10px; max-height: 62vh; overflow: auto; }
.lk-capture img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); }
.lk-capinfo { font-size: 12px; margin-top: 8px; overflow-wrap: anywhere; }
.lk-capactions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.lk-capactions #lookupBack { margin-right: auto; }
.lk-footer { flex-wrap: wrap; align-items: center; }
.lk-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-right: auto; font-size: 12.5px; color: var(--text-2); }
.lk-parts span { font-weight: 600; }
.lk-parts label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* Generadores y asistentes (inicio) */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.gen-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.gen-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.gen-card .section-icon { width: 38px; height: 38px; font-size: 18px; box-shadow: none; background: var(--bg-soft); border: 0; }
.gen-card strong { display: block; font-size: 14px; margin-bottom: 2px; }
.gen-card small { display: block; color: var(--text-3); font-size: 12.5px; line-height: 1.4; }

@media (max-width: 900px) {
    .search kbd { display: none; }
    .search { min-width: 0; }
    .section-head .count { display: none; }
    .overview { grid-template-columns: 1fr 1fr; gap: 8px; }
    .overview-card { padding: 10px; gap: 8px; }
    .overview-card .section-icon { width: 30px; height: 30px; font-size: 16px; }
    .search input { padding-right: 36px; }
    .grid { grid-template-columns: 1fr; }
    .cred-row { flex-wrap: wrap; }
    .cred-row .cred-label { width: 100%; }
    .lookup-grid { grid-template-columns: 1fr; }
    .lk-row { grid-template-columns: 1fr; gap: 2px; }
    .lk-tabs { padding: 8px 16px 0; }
}

/* Pestaña Correo del popup de dominios */
.lk-mail-link { margin: 14px 0 0; text-align: right; }
.lk-tabs { overflow-x: auto; }
.lk-tabs button { white-space: nowrap; }

/* Migraciones pendientes */
.mig-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.mig-list li { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning); font-size: 13px; overflow-wrap: anywhere; }
.mig-list code { font-weight: 600; }
.mig-list span { color: var(--text-2); }
