* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f2d3d;
    color: #fff;
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 8px;
}
.topbar-brand { font-weight: bold; font-size: 1.1rem; }
.topbar-nav a {
    color: #cbd5e1;
    text-decoration: none;
    margin-right: 16px;
    font-size: 0.95rem;
}
.topbar-nav a:hover { color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.topbar-user a { color: #fca5a5; text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.kpi-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.kpi-card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.kpi-card .kpi-value { font-size: 1.8rem; font-weight: bold; }
.kpi-card .kpi-label { color: #64748b; font-size: 0.85rem; }
.kpi-card.alerta .kpi-value { color: #dc2626; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}
th { background: #f1f5f9; color: #334155; }
tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef9c3; color: #854d0e; }
.badge.danger { background: #fee2e2; color: #991b1b; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
label { display: block; font-size: 0.8rem; color: #475569; margin-bottom: 4px; }
input, select, textarea {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}
textarea { width: 100%; min-height: 70px; }
button {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
button:hover { background: #1d4ed8; }
button.secondary { background: #64748b; }
button.danger { background: #dc2626; }

.copy-btn {
    background: #e2e8f0;
    color: #334155;
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-left: 4px;
}
.copy-btn:hover { background: #cbd5e1; }

.btn-link {
    display: inline-block;
    background: #16a34a;
    color: #fff;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none;
    margin-left: 6px;
}
.btn-link:hover { background: #15803d; }

dialog.modal {
    position: relative;
    border: none;
    border-radius: 8px;
    padding: 24px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.5); }
dialog.modal table { box-shadow: none; }
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    color: #64748b;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: #f1f5f9; color: #1f2937; }

.tabs { display: flex; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid #e2e8f0; }
.tabs a {
    padding: 10px 16px;
    text-decoration: none;
    color: #64748b;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
}
.tabs a.activo { color: #2563eb; border-bottom-color: #2563eb; font-weight: bold; }
.tabs a:hover { color: #1d4ed8; }

.cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}
.licitacion-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.licitacion-card-titulo {
    background: #1f2d3d;
    color: #fff;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: default;
}
.licitacion-card-cols { display: flex; align-items: stretch; }
.licitacion-card-body {
    flex: 1 1 55%;
    min-width: 280px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.licitacion-card-fila { font-size: 0.9rem; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.licitacion-card-label { color: #64748b; font-size: 0.75rem; text-transform: uppercase; margin-right: 4px; min-width: 70px; }
.licitacion-card-acciones { padding-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.licitacion-card-info {
    flex: 1 1 45%;
    min-width: 260px;
    padding: 12px 16px;
    background: #f8fafc;
    border-left: 1px solid #e5e7eb;
    font-size: 0.85rem;
}
.bases-btn { background: #7c3aed; margin-left: 0; }
.bases-btn:hover { background: #6d28d9; }
.info-bloque { margin-bottom: 10px; }
.info-bloque ul { margin: 4px 0 0; padding-left: 18px; }
.info-lista { margin: 0; padding-left: 18px; }
.info-lista li { margin-bottom: 4px; }

@media (max-width: 640px) {
    .licitacion-card-cols { flex-direction: column; }
    .licitacion-card-info { border-left: none; border-top: 1px solid #e5e7eb; }
}

.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.login-box h1 { font-size: 1.3rem; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field input { width: 100%; }
.error { color: #dc2626; font-size: 0.85rem; margin-bottom: 12px; }

.section-title { margin-top: 32px; margin-bottom: 12px; font-size: 1.1rem; }
.text-muted { color: #64748b; font-size: 0.85rem; }

.ficha-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #fff;
    font-size: 0.95rem;
}
.ficha-overlay.visible { display: flex; }
.ficha-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ficha-spin 0.8s linear infinite;
}
@keyframes ficha-spin { to { transform: rotate(360deg); } }

.ficha-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1001;
}
.ficha-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.ficha-toast.ok { background: #16a34a; }
.ficha-toast.error { background: #dc2626; }
