/* ============================================
   INTRANET CSS — Cordillera / ChileCompra
   Smart Opportunity Management
   ============================================ */
:root {
  --bg:         #0b1120;
  --bg-card:    #111827;
  --bg-sidebar: #0f172a;
  --bg-input:   #1e293b;
  --border:     #1e293b;
  --border-light:#334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --blue:       #3b82f6;
  --blue-glow:  rgba(59,130,246,.2);
  --cyan:       #06b6d4;
  --green:      #10b981;
  --green-glow: rgba(16,185,129,.15);
  --yellow:     #f59e0b;
  --yellow-glow:rgba(245,158,11,.15);
  --orange:     #f97316;
  --red:        #ef4444;
  --red-glow:   rgba(239,68,68,.15);
  --purple:     #8b5cf6;
  --white:      #ffffff;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.3);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
  --font:       'Inter', -apple-system, system-ui, sans-serif;
  --font-head:  'Outfit', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); overflow-x: hidden; line-height: 1.6; }
a { text-decoration: none; color: var(--cyan); }
a:hover { color: var(--blue); }
img { max-width: 100%; display: block; }

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.shake { animation: shake .4s ease; }

/* ---- LOGIN ---- */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 9999; }
.login-screen::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 50%, rgba(59,130,246,.08), transparent 70%), radial-gradient(ellipse at 70% 80%, rgba(6,182,212,.06), transparent 60%); }
.login-box { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 48px 40px; width: 380px; max-width: 90vw; text-align: center; box-shadow: var(--shadow); animation: fadeIn .5s ease; }
.login-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin: 0 auto 20px; filter: brightness(1.5); }
.login-box h1 { font-family: var(--font-head); font-size: 1.4rem; font-weight: 800; color: var(--white); margin-bottom: 6px; letter-spacing: .02em; }
.login-box p { font-size: .85rem; color: var(--text-muted); margin-bottom: 28px; }
.login-box input { width: 100%; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 13px 16px; color: var(--text); font-size: .9rem; margin-bottom: 14px; outline: none; transition: var(--transition); }
.login-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.btn-login { width: 100%; background: var(--blue); color: var(--white); border: none; padding: 13px; border-radius: var(--radius-sm); font-family: var(--font-head); font-weight: 700; font-size: .92rem; cursor: pointer; transition: var(--transition); }
.btn-login:hover { background: #2563eb; transform: translateY(-1px); }
.login-error { color: var(--red); font-size: .82rem; margin-top: 10px; min-height: 1.2em; }
.login-footer { margin-top: 20px; display: flex; justify-content: center; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 15px; }
.forgot-pass { font-size: 0.78rem; color: var(--text-dim); transition: var(--transition); cursor: pointer; }
.forgot-pass:hover { color: var(--blue); text-decoration: underline; }
.hidden { display: none !important; }

/* ---- LAYOUT ---- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 100; }
.main { flex: 1; margin-left: 260px; padding: 0 0 40px; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
.sidebar-logo { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; filter: brightness(1.5); }
.sidebar-title { font-family: var(--font-head); font-weight: 800; font-size: .85rem; color: var(--white); letter-spacing: .08em; }
.sidebar-sub { font-size: .7rem; color: var(--text-dim); margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.snav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: var(--transition); background: none; border: none; text-align: left; width: 100%; font-family: var(--font); }
.snav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.snav-item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.snav-item.active { background: var(--blue-glow); color: var(--blue); font-weight: 600; }
.snav-count { margin-left: auto; background: var(--blue); color: var(--white); font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 100px; min-width: 22px; text-align: center; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.snav-logout { color: var(--red) !important; }
.snav-logout:hover { background: var(--red-glow) !important; }

/* ---- TOPBAR ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); }
.topbar h2 { font-family: var(--font-head); font-size: 1.2rem; font-weight: 800; color: var(--white); }
.topbar span { font-size: .78rem; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: .82rem; color: var(--text-muted); text-transform: capitalize; }
.btn-refresh { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; color: var(--text-muted); cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.btn-refresh svg { width: 18px; height: 18px; }
.btn-refresh:hover { background: var(--blue-glow); color: var(--blue); border-color: var(--blue); }

/* ---- STATS ROW ---- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 24px 32px 0; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); animation: fadeIn .4s ease both; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.stat-icon { font-size: 1.6rem; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-accent .stat-icon { background: var(--red-glow); }
.stat-warning .stat-icon { background: var(--yellow-glow); }
.stat-blue .stat-icon { background: var(--blue-glow); }
.stat-green .stat-icon { background: var(--green-glow); }
.stat-number { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; color: var(--white); display: block; }
.stat-label { font-size: .78rem; color: var(--text-dim); }

/* ---- DASHBOARD SECTIONS ---- */
.dash-section { padding: 28px 32px 0; animation: fadeIn .5s ease both; }
.dash-section:nth-child(2) { animation-delay: .1s; }
.dash-section:nth-child(3) { animation-delay: .2s; }
.dash-section:nth-child(4) { animation-delay: .3s; }
.dash-section-header { margin-bottom: 18px; }
.dash-section-header h3 { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.dash-section-sub { font-size: .8rem; color: var(--text-dim); }
.dash-loading { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 48px 0; color: var(--text-muted); font-size: .88rem; }
.dash-empty { padding: 32px; text-align: center; color: var(--text-dim); font-size: .88rem; background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius); }

/* Sector tabs */
.dash-sector-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.dst-btn { background: var(--bg-input); border: 1px solid var(--border); border-radius: 100px; padding: 7px 16px; font-size: .78rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); font-family: var(--font); }
.dst-btn:hover { border-color: var(--border-light); color: var(--text); }
.dst-btn.active { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* ---- RESULT CARDS ---- */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }

.r-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: var(--transition); position: relative; display: flex; flex-direction: column; gap: 10px; animation: fadeIn .35s ease both; }
.r-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(59,130,246,.12); }

/* Urgency borders */
.r-card.urgency-critical { border-left: 3px solid var(--red); }
.r-card.urgency-high { border-left: 3px solid var(--orange); }
.r-card.urgency-medium { border-left: 3px solid var(--yellow); }

.r-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.r-card-title-wrap { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.r-card-top h4 { font-family: var(--font-head); font-size: .92rem; font-weight: 700; color: var(--white); line-height: 1.35; }
.r-card-badges { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }

.urgency-badge { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 100px; white-space: nowrap; }
.btn-proposal { background: var(--blue-glow); color: var(--blue); border: 1px solid var(--blue); padding: 4px 10px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; cursor: pointer; transition: var(--transition); position: absolute; right: 10px; top: 10px; opacity: 0; }
.r-card:hover .btn-proposal { opacity: 1; }
.btn-proposal:hover { background: var(--blue); color: var(--white); }

.urgency-critical { background: var(--red-glow); color: var(--red); }

.urgency-high { background: var(--yellow-glow); color: var(--orange); }
.urgency-medium { background: rgba(245,158,11,.1); color: var(--yellow); }

.score-badge { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 100px; white-space: nowrap; }
.score-high { background: var(--green-glow); color: var(--green); }
.score-mid { background: var(--blue-glow); color: var(--blue); }
.score-low { background: rgba(148,163,184,.1); color: var(--text-dim); }

.r-card-type { font-size: .68rem; font-weight: 700; letter-spacing: .05em; padding: 3px 8px; border-radius: 100px; background: var(--blue-glow); color: var(--blue); white-space: nowrap; }
.type-CO { background: rgba(139,92,246,.15); color: var(--purple); }
.type-LS { background: var(--green-glow); color: var(--green); }
.type-LP { background: var(--yellow-glow); color: var(--yellow); }
.type-LQ { background: rgba(236,72,153,.15); color: #ec4899; }
.type-SE { background: rgba(14,165,233,.15); color: #0ea5e9; }

.r-card-org { font-size: .8rem; color: var(--text-muted); }
.r-card-desc { font-size: .8rem; color: var(--text-dim); line-height: 1.5; }
.r-card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: .76rem; color: var(--text-dim); }
.r-card-meta strong { color: var(--text-muted); }
.r-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.r-card-monto { font-family: var(--font-head); font-weight: 700; font-size: .95rem; color: var(--green); }
.r-card-actions { display: flex; gap: 8px; }
.r-btn { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; font-size: .76rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); font-family: var(--font); white-space: nowrap; }
.r-btn:hover { border-color: var(--blue); color: var(--blue); }
.r-btn.saved { background: var(--green-glow); border-color: var(--green); color: var(--green); }
.r-btn-detail { border-color: var(--blue); color: var(--blue); background: var(--blue-glow); }
.r-btn-detail:hover { background: var(--blue); color: var(--white); }

.status-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 4px 12px; border-radius: 100px; }
.status-interesante { background: rgba(245,158,11,.15); color: var(--yellow); }
.status-preparando { background: rgba(139,92,246,.15); color: var(--purple); }
.status-postulando { background: var(--blue-glow); color: var(--blue); }
.status-enviada { background: rgba(14,165,233,.15); color: #0ea5e9; }
.status-ganada { background: var(--green-glow); color: var(--green); }
.status-descartada { background: var(--red-glow); color: var(--red); }

/* ---- SEARCH TAB ---- */
.quick-keywords { display: flex; flex-wrap: wrap; gap: 8px; padding: 24px 32px 0; align-items: center; }
.qk-label { font-size: .78rem; color: var(--text-dim); font-weight: 600; margin-right: 4px; }
.qk-btn { background: var(--bg-input); border: 1px solid var(--border); border-radius: 100px; padding: 6px 14px; font-size: .76rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); font-family: var(--font); }
.qk-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-glow); }

.search-bar-wrapper { padding: 16px 32px; }
.search-bar { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 6px 8px 6px 18px; transition: var(--transition); }
.search-bar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.search-bar svg { width: 20px; height: 20px; color: var(--text-dim); flex-shrink: 0; }
.search-bar input { flex: 1; background: none; border: none; color: var(--text); font-size: .9rem; padding: 10px 0; outline: none; font-family: var(--font); }
.search-bar input::placeholder { color: var(--text-dim); }
.btn-search { background: var(--blue); color: var(--white); border: none; padding: 10px 24px; border-radius: var(--radius-sm); font-family: var(--font-head); font-weight: 700; font-size: .85rem; cursor: pointer; transition: var(--transition); }
.btn-search:hover { background: #2563eb; }

.search-filters { display: flex; gap: 10px; margin-top: 12px; }
.search-filters select { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); font-size: .82rem; outline: none; cursor: pointer; transition: var(--transition); font-family: var(--font); flex: 1; }
.search-filters select:focus { border-color: var(--blue); }

/* API Notice */
.api-notice { display: flex; gap: 14px; align-items: flex-start; margin: 0 32px; padding: 16px 20px; background: var(--blue-glow); border: 1px solid rgba(59,130,246,.3); border-radius: var(--radius); font-size: .84rem; color: var(--text-muted); position: relative; }
.api-notice svg { width: 20px; height: 20px; color: var(--blue); flex-shrink: 0; margin-top: 2px; }
.api-notice strong { color: var(--white); }
.api-notice a { color: var(--cyan); }
.api-notice small { color: var(--text-dim); }
.api-notice-close { position: absolute; top: 8px; right: 12px; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: .9rem; }
.api-notice.hidden { display: none; }

/* Results header */
.results-header { display: flex; gap: 8px; padding: 0 32px 12px; font-size: .85rem; color: var(--text-muted); align-items: center; }
.results-header strong { color: var(--white); }

/* Empty / Loading */
.results-empty { text-align: center; padding: 60px 32px; margin: 0 32px; }
.results-empty.hidden { display: none; }
.empty-icon { font-size: 2.4rem; margin-bottom: 14px; }
.results-empty h3 { font-family: var(--font-head); font-size: 1.1rem; color: var(--white); margin-bottom: 6px; }
.results-empty p { color: var(--text-dim); font-size: .88rem; }

.results-loading { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 60px 0; color: var(--text-muted); }
.results-loading.hidden { display: none; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }

/* Grids in tabs */
#results-grid, #guardadas-grid, #postulaciones-grid { padding: 0 32px; }

/* ---- TAB TOOLBAR ---- */
.tab-toolbar { padding: 20px 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.filter-input { flex: 1; min-width: 240px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; color: var(--text); font-size: .88rem; outline: none; transition: var(--transition); font-family: var(--font); }
.filter-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }

.kanban-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.kf-btn { background: var(--bg-input); border: 1px solid var(--border); border-radius: 100px; padding: 7px 16px; font-size: .78rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); font-family: var(--font); }
.kf-btn:hover { border-color: var(--border-light); color: var(--text); }
.kf-btn.active { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* ---- CONFIG ---- */
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; padding: 24px 32px; }
.config-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.config-card h3 { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--white); margin-bottom: 8px; }
.config-card p { font-size: .84rem; color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }
.config-card code { background: var(--bg-input); padding: 2px 8px; border-radius: 4px; font-size: .82rem; color: var(--cyan); }
.form-g { margin-bottom: 14px; }
.form-g label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.form-g input, .form-g select, .form-g textarea { width: 100%; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); font-size: .88rem; outline: none; transition: var(--transition); font-family: var(--font); }
.form-g input:focus, .form-g select:focus, .form-g textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.form-g textarea { resize: vertical; min-height: 80px; }

.btn-save { background: var(--blue); color: var(--white); border: none; padding: 10px 22px; border-radius: var(--radius-sm); font-family: var(--font-head); font-weight: 700; font-size: .82rem; cursor: pointer; transition: var(--transition); }
.btn-save:hover { background: #2563eb; }
.btn-danger { background: var(--red-glow); color: var(--red); border: 1px solid rgba(239,68,68,.3); padding: 10px 22px; border-radius: var(--radius-sm); font-family: var(--font-head); font-weight: 700; font-size: .82rem; cursor: pointer; transition: var(--transition); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.saved-msg { display: inline-block; font-size: .82rem; color: var(--green); margin-left: 12px; }

/* Keywords */
.keywords-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kw-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 100px; padding: 5px 12px; font-size: .78rem; color: var(--text-muted); }
.kw-tag button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: .7rem; padding: 0 2px; }
.kw-tag button:hover { color: var(--red); }
.kw-add { display: flex; gap: 8px; }
.kw-add input { flex: 1; }

/* Region checks */
.region-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 16px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition); }
.check-label:hover { color: var(--text); }
.check-label input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; cursor: pointer; }

/* ---- MODAL ---- */
.modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.modal-box { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; width: 640px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.4); animation: fadeIn .25s ease; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 12px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--white); line-height: 1.3; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--red); }
.modal-body { padding: 16px 28px; }

.detail-grid { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.detail-label { font-size: .78rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.detail-value { font-size: .88rem; color: var(--text); text-align: right; }
.detail-value.mono { font-family: 'Courier New', monospace; font-size: .82rem; color: var(--cyan); }
.detail-value.monto { font-family: var(--font-head); font-weight: 700; color: var(--green); }
.detail-value em { color: var(--text-dim); font-style: normal; font-size: .82rem; }
.detail-desc { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-desc p { font-size: .88rem; color: var(--text-muted); line-height: 1.65; margin-top: 8px; }

.modal-footer { padding: 16px 28px 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.btn-primary-sm { background: var(--blue); color: var(--white); border: none; padding: 10px 22px; border-radius: var(--radius-sm); font-weight: 700; font-size: .82rem; cursor: pointer; transition: var(--transition); font-family: var(--font-head); }
.btn-primary-sm:hover { background: #2563eb; }
.btn-outline-sm { background: transparent; color: var(--cyan); border: 1px solid rgba(6,182,212,.3); padding: 10px 22px; border-radius: var(--radius-sm); font-weight: 600; font-size: .82rem; cursor: pointer; transition: var(--transition); font-family: var(--font); }
.btn-outline-sm:hover { background: rgba(6,182,212,.1); }
.btn-danger-sm { background: transparent; color: var(--red); border: 1px solid rgba(239,68,68,.25); padding: 10px 22px; border-radius: var(--radius-sm); font-weight: 600; font-size: .82rem; cursor: pointer; transition: var(--transition); font-family: var(--font); }
.btn-danger-sm:hover { background: var(--red-glow); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main { margin-left: 220px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 16px 0; }
  .stat-card { padding: 14px; }
  .stat-number { font-size: 1.2rem; }
  .dash-section, .search-bar-wrapper, .quick-keywords, .config-grid, .tab-toolbar { padding-left: 16px; padding-right: 16px; }
  #results-grid, #guardadas-grid, #postulaciones-grid { padding: 0 16px; }
  .results-grid { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
  .config-grid { grid-template-columns: 1fr; }
  .search-filters { flex-direction: column; }
  .modal-box { max-width: 96vw; }
  .api-notice { margin: 0 16px; }
}
/* ---- OPPORTUNITY MAP ---- */
.dash-map-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; margin-top: 24px; padding: 0 32px; }
.map-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; position: relative; height: 500px; }
.map-container { display: flex; justify-content: center; align-items: center; flex: 1; position: relative; background: radial-gradient(circle at center, rgba(59,130,246,0.05), transparent 70%); border-radius: var(--radius-sm); }
.map-chile { height: 400px; width: auto; filter: drop-shadow(0 0 15px rgba(59,130,246,0.1)); cursor: crosshair; }
.map-region { fill: #1e293b; stroke: #334155; stroke-width: 0.8px; transition: all 0.2s ease; cursor: pointer; }
.map-region:hover { fill: #3b82f6; stroke: #fff; stroke-width: 1.5px; }
.map-region.active { fill: var(--cyan); stroke: var(--white); stroke-width: 1.5px; }

.map-stats-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 8px; }
.map-stats-list::-webkit-scrollbar { width: 4px; }
.map-stats-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.mstat-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; transition: var(--transition); cursor: pointer; }
.mstat-item:hover { background: rgba(255,255,255,0.03); }
.mstat-item.active { background: var(--blue-glow); border-color: var(--blue); }
.mstat-name { flex: 1; font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
.mstat-count { font-family: var(--font-head); font-size: 0.85rem; font-weight: 700; color: var(--cyan); }

/* ---- PROPOSAL MODAL ---- */
.proposal-editor { display: flex; flex-direction: column; gap: 16px; }
.proposal-toolbar { display: flex; gap: 10px; margin-bottom: 8px; }
.proposal-textarea { width: 100%; min-height: 400px; background: #0f172a; border: 1px solid var(--border); border-radius: 8px; padding: 20px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.9rem; line-height: 1.6; resize: none; border-left: 4px solid var(--blue); }
.proposal-textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-glow); }
.proposal-copy-hint { font-size: 0.78rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }

/* Responsive adjustments for map grid */
@media (max-width: 1200px) {
  .dash-map-grid { grid-template-columns: 1fr; }
  .map-card { height: auto; min-height: 500px; }
}

/* ===========================
   FILTER UI & URGENCY
   =========================== */
.dash-filters-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 180px;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.filter-select {
  padding: 0.6rem 0.8rem;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
  transition: all 0.3s ease;
  cursor: pointer;
  font-family: inherit;
}

.filter-select:hover { border-color: var(--blue); background: #1e293b; }
.filter-select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-glow); }

.urgency-critical {
  border-color: #ef4444 !important;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), transparent) !important;
}

.urgency-badge.urgency-critical {
  background: #ef4444;
  color: white;
  animation: pulse-urgency 2s infinite;
}

@keyframes pulse-urgency {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

.type-Suministro { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.type-Servicio { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

.score-badge { font-weight: 700; letter-spacing: -0.02em; }
