/* ============================================================
   Subvenciones Clover · Estilo Clover (Monitor/Leads/Redes)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Backgrounds */
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface2: #ffffff;
    --surface3: #f1f3f5;

    /* Borders */
    --border: #e3e6ea;
    --border-strong: #d3d7dd;

    /* Topbar */
    --topbar: #ffffff;
    --topbar-text: #111114;

    /* Brand */
    --accent: #1f7a3f;
    --accent-hover: #1b6b37;
    --accent2: #5f37c4;
    --accent3: #1a73e8;

    /* Text */
    --text: #111114;
    --text-muted: #475467;
    --muted: #6b7280;

    /* States */
    --danger: #e02424;
    --danger-bg: #fdecec;
    --warning: #d97706;
    --warning-bg: #fff8eb;
    --success: #15803d;
    --success-bg: #ecfdf5;

    /* Typography */
    --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', Menlo, Monaco, Consolas, monospace;

    /* Layout */
    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    background: var(--topbar);
    color: var(--topbar-text);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 48px;
    z-index: 100;
    border-bottom: 1px solid #eee;
    box-shadow: none;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.topbar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.topbar-logo {
    height: 28px;
    width: auto;
    display: block;
}
.topbar-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(0,0,0,0.55);
    letter-spacing: 0.02em;
    padding-left: 12px;
    border-left: 1px solid rgba(0,0,0,0.12);
}
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.topbar-nav a {
    color: rgba(0,0,0,0.65);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 300;
    transition: all 0.15s;
    white-space: nowrap;
}
.topbar-nav a:hover {
    background: rgba(0,0,0,0.06);
    color: #000;
}
.topbar-nav a.active {
    background: #000;
    color: #fff;
}
.btn-mini {
    display: inline-block;
    background: var(--accent);
    color: white !important;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
}
.btn-mini:hover {
    background: var(--accent-hover);
    color: white !important;
}
.topbar-logout {
    color: rgba(0,0,0,0.45) !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
}
.topbar-logout:hover { color: #000 !important; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px 80px;
}
.bottombar {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.page-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ============================================================
   METRICS
   ============================================================ */
.metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.metric:hover { box-shadow: var(--shadow); }
.metric-warn { border-left: 3px solid var(--warning); }
.metric-muted { opacity: 0.7; }
.metric-num {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.metric-lbl {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 6px;
    font-weight: 500;
}

/* ============================================================
   CHIPS DE SERVICIO
   ============================================================ */
.servicios-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.servicios-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
    margin-right: 6px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface3);
    color: var(--text) !important;
    border: 1px solid transparent;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.chip:hover {
    background: var(--text);
    color: white !important;
}
.chip-active {
    background: var(--accent) !important;
    color: white !important;
}
.chip-count {
    background: rgba(0,0,0,0.07);
    padding: 1px 8px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    color: inherit;
    font-family: var(--mono);
}
.chip:hover .chip-count { background: rgba(255,255,255,0.2); }
.chip-active .chip-count { background: rgba(255,255,255,0.25); }

/* ============================================================
   FILTERS
   ============================================================ */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.filters select,
.filters input[type=search],
.filters input[type=text] {
    border: 1px solid var(--border-strong);
    padding: 9px 14px;
    font-family: var(--font);
    font-size: 13px;
    background: white;
    border-radius: var(--radius-sm);
    min-height: 38px;
    color: var(--text);
    font-weight: 400;
    transition: border-color 0.15s;
}
.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--accent);
}
.filters input[type=search] { min-width: 240px; flex: 1; max-width: 320px; }
.filters .check {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}
.filters .check input { accent-color: var(--accent); }
.filters button {
    background: var(--accent);
    color: white;
    border: 0;
    padding: 9px 20px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.filters button:hover { background: var(--accent-hover); }
.btn-mini-ghost {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 10px;
}
.btn-mini-ghost:hover { color: var(--accent); }

.results-count {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
    font-weight: 500;
}

/* ============================================================
   CARDS
   ============================================================ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
    position: relative;
}
.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.card-descartada { opacity: 0.55; }
.card-interesante { border-left: 3px solid var(--warning); }
.card-asignada { border-left: 3px solid var(--accent); }
.card-aplicada { border-left: 3px solid var(--accent3); }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
}
.meta-org {
    color: var(--muted);
    font-weight: 500;
    font-size: 11px;
}
.meta-tag {
    background: var(--surface3);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.02em;
    font-weight: 500;
}
/* Bases reguladoras y planes estratégicos: avisos tempranos, todavía sin
   convocatoria. Se marcan para no confundirlos con algo a lo que ya se pueda
   presentar una solicitud. */
.meta-tag-tipo {
    background: #fdf0d5;
    color: #8a5a00;
    font-weight: 600;
}
.meta-score {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.score-high { background: var(--accent); color: white; }
.score-mid { background: var(--warning); color: white; }
.score-low { background: var(--border-strong); color: var(--text-muted); }
.meta-type {
    background: var(--text);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.card-status {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border-radius: 100px;
    background: var(--surface3);
    color: var(--muted);
    flex-shrink: 0;
    font-weight: 600;
}
.status-interesante { background: var(--warning-bg); color: var(--warning); }
.status-asignada { background: var(--success-bg); color: var(--success); }
.status-descartada { background: var(--surface3); color: var(--muted); }
.status-aplicada { background: #e0eaff; color: var(--accent3); }
.status-nueva { background: var(--success-bg); color: var(--success); }

.card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.005em;
}
.card-resumen {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.card-info {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.card-info span { color: var(--muted); }
.card-info b { color: var(--text); font-weight: 600; }
.urg-alta { color: var(--danger) !important; }
.urg-media { color: var(--warning) !important; }
.urg-cerrada { color: var(--muted) !important; text-decoration: line-through; }

.card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 8px;
}
.quick-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    background: var(--accent);
    color: white !important;
    border: 0;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    line-height: 1.3;
    font-family: var(--font);
    transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); color: white !important; }
.btn-ghost {
    background: white !important;
    color: var(--text) !important;
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface3) !important; border-color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c11d1d; }

.btn-icon {
    background: white;
    border: 1px solid var(--border-strong);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.15s;
}
.btn-icon:hover {
    background: var(--text);
    color: white;
    border-color: var(--text);
}
.btn-icon-sm {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
}
.btn-icon-sm:hover { color: var(--danger); }

/* ============================================================
   DETAIL
   ============================================================ */
.back {
    font-size: 12px;
    color: var(--muted);
    display: inline-block;
    margin-bottom: 16px;
    font-weight: 500;
}
.back:hover { color: var(--accent); }
.detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}
.detail-head {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.detail-meta { margin-bottom: 14px; }
.detail h1 {
    font-weight: 600;
    font-size: 24px;
    line-height: 1.3;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.015em;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}
.detail-card {
    background: var(--surface3);
    border-radius: var(--radius);
    padding: 18px;
}
.detail-card h4 {
    margin: 0 0 12px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
}
.detail-card dl { margin: 0; }
.detail-card dt {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
    font-weight: 500;
}
.detail-card dt:first-child { margin-top: 0; }
.detail-card dd { margin: 2px 0 0; font-size: 14px; color: var(--text); }
.meta-days { color: var(--muted); font-size: 12px; }

.detail-block { margin-bottom: 24px; }
.detail-block h3 {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}
.detail-block p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}
.resumen-ia {
    background: var(--success-bg);
    padding: 14px 18px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text) !important;
}

.detail-actions {
    background: var(--surface3);
    padding: 22px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.detail-actions h3 {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 14px;
}
.form-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-inline label.full { grid-column: 1 / -1; }
.form-inline label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.form-inline input,
.form-inline select,
.form-inline textarea {
    border: 1px solid var(--border-strong);
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: white;
}
.form-inline input:focus,
.form-inline select:focus,
.form-inline textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-inline button {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 6px;
}

.detail-links { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
    width: 100%;
    background: var(--surface);
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th {
    background: var(--surface3);
    padding: 12px 16px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--surface3); }
.row-err td { background: var(--danger-bg); }
.badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 100px;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.msg { font-size: 11px; color: var(--muted); }

/* ============================================================
   FORMS
   ============================================================ */
.add-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.add-form summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--accent);
}
.add-form[open] summary { border-bottom: 1px solid var(--border); }
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 18px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input,
.form-grid textarea {
    border: 1px solid var(--border-strong);
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: var(--radius-sm);
}
.form-grid input:focus,
.form-grid textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-grid button {
    grid-column: 1 / -1;
    justify-self: start;
}

/* ============================================================
   EMPTY / MUTED
   ============================================================ */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 16px;
}
.muted { color: var(--muted); }

/* ============================================================
   TERMINAL
   ============================================================ */
.terminal {
    background: #0d0d10;
    color: #c7c7d1;
    font-family: var(--mono);
    font-size: 12px;
    padding: 20px;
    border-radius: var(--radius);
    max-height: 520px;
    overflow: auto;
    line-height: 1.6;
    border: 1px solid var(--border);
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
    font-family: var(--font);
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
}
.login-brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo {
    height: 48px;
    width: auto;
    margin: 0 auto 12px;
    display: block;
}
.login-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.01em;
}
.login-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.login-form input {
    border: 1px solid var(--border-strong);
    padding: 12px 14px;
    font-family: var(--font);
    font-size: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    transition: all 0.15s;
}
.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(31,122,63,0.1);
}
.login-form button {
    margin-top: 10px;
    background: var(--accent);
    color: white;
    border: 0;
    padding: 13px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background 0.15s;
}
.login-form button:hover { background: var(--accent-hover); }
.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border-left: 3px solid var(--danger);
    font-weight: 500;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-inline { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr; }
    .topbar {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .topbar-brand { width: 100%; }
    .topbar-title { display: none; }
    .topbar-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 2px;
    }
    .topbar-nav a {
        padding: 6px 10px;
        font-size: 12px;
    }
    .container { padding: 16px; }
    .detail { padding: 20px; }
    .filters input[type=search] { min-width: 100%; max-width: 100%; }
    .servicios-bar { padding: 12px; gap: 5px; }
    .chip { font-size: 11px; padding: 5px 10px; }
}

/* ============================================================
   FICHA RESUMIDA (IA)
   Resumen de las bases para no tener que leerse el PDF entero.
   ============================================================ */
.ficha {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 22px;
    margin-bottom: 20px;
}
.ficha-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 16px;
}
.ficha h3 { margin: 0; font-size: 16px; }
.ficha-nota { font-size: 11px; color: var(--muted); }
.ficha-regen { font-size: 11px; }
.ficha-cargando { color: var(--muted); }
.ficha-error {
    background: #fff4f4;
    border: 1px solid #f3c9c9;
    color: #8a2222;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 13px;
}

/* Las cifras que se miran primero: cuánto financia y si encaja con Clover */
.ficha-cifras {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.ficha-cifras > div {
    background: var(--surface3);
    border-radius: 6px;
    padding: 10px 14px;
    min-width: 120px;
}
.ficha-cifras b { display: block; font-size: 19px; line-height: 1.2; }
.ficha-cifras span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.encaje-alto   { background: #e7f6ec; } .encaje-alto b   { color: var(--accent); }
.encaje-medio  { background: #fdf6e3; } .encaje-medio b  { color: #8a5a00; }
.encaje-bajo,
.encaje-ninguno { background: var(--surface3); } .encaje-bajo b, .encaje-ninguno b { color: var(--muted); }

.ficha-sec { margin-bottom: 16px; }
.ficha-sec h4 {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.ficha-sec p { margin: 0 0 8px; font-size: 13px; }
.ficha-sec ul { margin: 0; padding-left: 18px; }
.ficha-sec li { font-size: 13px; margin-bottom: 3px; }
.ficha-regimen { font-weight: 600; }

/* Categorías de gasto: las que Clover puede facturar se destacan */
.ficha-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ficha-cat {
    background: var(--surface3);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 11px;
    color: var(--text-muted);
}
.ficha-cat-clover {
    background: #e7f6ec;
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   CAPTACIÓN DE CLIENTES DESDE UNA CONVOCATORIA
   ============================================================ */
.captar-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: #e7f6ec;
    border: 1px solid #bfe3cc;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.captar-cta b { display: block; font-size: 14px; }
.captar-cta span { font-size: 12px; color: var(--text-muted); }

.captar-form label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.captar-form input[type=text],
.captar-form input[type=number] {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
}
.captar-form .captar-fila { display: flex; gap: 12px; }
.captar-form .captar-fila label { flex: 1; }
.captar-form label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.captar-ayuda { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }

.tabla-mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.tabla-mini th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px 4px 0; }
.tabla-mini td { padding: 4px 8px 4px 0; border-top: 1px solid var(--border); }

/* Acciones rápidas en la ficha: descartar sin volver al listado */
.acciones-rapidas {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 10px 0 16px;
}
.acciones-rapidas form { display: flex; gap: 8px; }
.acciones-estado { font-size: 12px; color: var(--muted); }
/* Fondo negro: .btn fuerza color:white !important, así que cualquier variante
   con fondo claro deja el texto blanco sobre blanco e invisible. */
.btn-descartar { background: #111827; border-color: #111827; }
.btn-descartar:hover { background: #000; }

/* Buscador de concesiones: el campo de términos ocupa su propia línea y crece,
   porque "Ampliar" lo llena de diez palabras y en una línea no se ven. */
.filters-concesiones .linea-busqueda {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-basis: 100%;
    width: 100%;
}
.filters-concesiones textarea {
    flex: 1;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    background: #fff;
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
}
.filters-concesiones textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.filters-concesiones .linea-busqueda .btn { white-space: nowrap; }

/* Etiquetas de comunidad clicables en el vacío del buscador de concesiones */
.ficha-cat-link { text-decoration: none; transition: background .15s, color .15s; }
.ficha-cat-link:hover { background: var(--text); color: #fff !important; }

/* Acciones por fila en el buscador de concesiones */
.acciones-fila { display: flex; gap: 5px; }
.btn-mini-accion { padding: 4px 9px !important; font-size: 11px !important; font-weight: 500 !important; }

/* Periodo de ejecución del gasto: decide si aún hay algo que vender */
.ficha-ejecucion {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid;
}
.ficha-ejecucion-cabecera { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ficha-ejecucion-cabecera b { font-size: 15px; }
.ficha-ejecucion-cabecera span { font-size: 12px; opacity: .8; }
.ficha-ejecucion p { margin: 6px 0 0; font-size: 13px; }
.ficha-comprobar {
    background: rgba(255,255,255,.6);
    border-radius: 5px;
    padding: 8px 10px;
    margin-top: 8px !important;
}
.ej-bueno { background: #e7f6ec; border-color: #bfe3cc; color: #14532d; }
.ej-medio { background: #fdf6e3; border-color: #f0e0b0; color: #7a5a00; }
.ej-malo  { background: #fdecec; border-color: #f3c9c9; color: #8a2222; }
.ej-duda  { background: var(--surface3); border-color: var(--border); color: var(--text-muted); }

/* Marca en el listado de concesiones: ¿queda algo por ejecutar? */
.etiqueta-ejecucion {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

/* Nominativas: no se puede optar, pero el beneficiario es un cliente */
.meta-tag-nominativa { background: #ede9fe; color: #5b21b6; font-weight: 600; }

/* Panel: embudo de conversión */
.embudo-fila {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: var(--surface3);
    overflow: hidden;
}
.embudo-barra { position: absolute; inset: 0 auto 0 0; background: #d7ecdf; }
.embudo-simple { background: transparent; border-bottom: 1px solid var(--border); border-radius: 0; }
.embudo-texto, .embudo-num { position: relative; font-size: 13px; }
.embudo-num { font-size: 15px; }
.captar-cta-gris { background: var(--surface3); border-color: var(--border); }

/* Las tarjetas de métricas llevan a su listado */
a.metric { display: block; text-decoration: none; color: inherit; }
a.metric:hover { box-shadow: var(--shadow); border-color: var(--border-strong); color: inherit; }
a.metric:hover .metric-num { color: var(--accent); }
